Commit dcae5dac authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

[media] solo6x10: sync to latest code from Bluecherry's git repo

Synced to commit e9815ac5503ae60cfbf6ff8037035de8f62e2846 from
branch next in git repository https://github.com/bluecherrydvr/solo6x10.git
Only removed some code under #if LINUX_VERSION_CODE < some-kernel-version,
renamed the driver back to solo6x10 from solo6x10-edge, removed the
unnecessary compat.h header and kept the slab.h includes.
Otherwise the code is identical.
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarIsmael Luceno <ismael.luceno@corp.bluecherry.net>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent c535cc6c
solo6x10-y := core.o i2c.o p2m.o v4l2.o tw28.o gpio.o disp.o enc.o v4l2-enc.o g723.o
solo6x10-y := core.o i2c.o p2m.o v4l2.o tw28.o gpio.o disp.o enc.o v4l2-enc.o g723.o eeprom.o
obj-$(CONFIG_SOLO6X10) += solo6x10.o
TODO (staging => main):
* Motion detection flags need to be moved to v4l2
* Some private CIDs need to be moved to v4l2
TODO (general):
* encoder on/off controls
* mpeg cid bitrate mode (vbr/cbr)
* mpeg cid bitrate/bitrate-peak
* mpeg encode of user data
* mpeg decode of user data
* switch between 4 frames/irq to 1 when using mjpeg (and then back
when not)
* implement a CID control for motion areas/thresholds
* implement CID controls for mozaic areas
* allow for higher level of interval (for < 1 fps)
* sound:
- implement playback via external sound jack
- implement loopback of external sound jack with incoming audio?
- implement pause/resume
- batch up desc requests for more efficient use of p2m?
- encoder on/off controls
- mpeg cid bitrate mode (vbr/cbr)
- mpeg cid bitrate/bitrate-peak
- mpeg encode of user data
- mpeg decode of user data
- implement CID controls for mozaic areas
- sound
- implement playback via external sound jack
- implement loopback of external sound jack with incoming audio?
- implement pause/resume (make use of in bc-server)
Please send patches to the linux media list <linux-media@vger.kernel.org> and
Cc Ismael Luceno <ismael.luceno@corp.bluecherry.net>.
This diff is collapsed.
/*
* Copyright (C) 2010 Bluecherry, LLC www.bluecherrydvr.com
* Copyright (C) 2010 Ben Collins <bcollins@bluecherry.net>
* Copyright (C) 2010-2013 Bluecherry, LLC <http://www.bluecherrydvr.com>
*
* Original author:
* Ben Collins <bcollins@ubuntu.com>
*
* Additional work by:
* John Brooks <john.brooks@bluecherry.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -21,6 +26,7 @@
#include <linux/module.h>
#include <linux/videodev2.h>
#include <media/v4l2-ioctl.h>
#include "solo6x10.h"
#define SOLO_VCLK_DELAY 3
......@@ -30,8 +36,8 @@
#define SOLO_MOT_THRESH_H 64
#define SOLO_MOT_THRESH_SIZE 8192
#define SOLO_MOT_THRESH_REAL (SOLO_MOT_THRESH_W * SOLO_MOT_THRESH_H)
#define SOLO_MOT_FLAG_SIZE 512
#define SOLO_MOT_FLAG_AREA (SOLO_MOT_FLAG_SIZE * 32)
#define SOLO_MOT_FLAG_SIZE 1024
#define SOLO_MOT_FLAG_AREA (SOLO_MOT_FLAG_SIZE * 16)
static unsigned video_type;
module_param(video_type, uint, 0644);
......@@ -73,7 +79,12 @@ static void solo_vin_config(struct solo_dev *solo_dev)
solo_reg_write(solo_dev, SOLO_VI_CH_FORMAT,
SOLO_VI_FD_SEL_MASK(0) | SOLO_VI_PROG_MASK(0));
solo_reg_write(solo_dev, SOLO_VI_FMT_CFG, 0);
/* On 6110, initialize mozaic darkness stength */
if (solo_dev->type == SOLO_DEV_6010)
solo_reg_write(solo_dev, SOLO_VI_FMT_CFG, 0);
else
solo_reg_write(solo_dev, SOLO_VI_FMT_CFG, 16 << 22);
solo_reg_write(solo_dev, SOLO_VI_PAGE_SW, 2);
if (solo_dev->video_type == SOLO_VO_FMT_TYPE_NTSC) {
......@@ -97,21 +108,30 @@ static void solo_vin_config(struct solo_dev *solo_dev)
SOLO_VI_PB_HSTOP(16 + 720));
}
static void solo_disp_config(struct solo_dev *solo_dev)
static void solo_vout_config_cursor(struct solo_dev *dev)
{
int i;
/* Load (blank) cursor bitmap mask (2bpp) */
for (i = 0; i < 20; i++)
solo_reg_write(dev, SOLO_VO_CURSOR_MASK(i), 0);
solo_reg_write(dev, SOLO_VO_CURSOR_POS, 0);
solo_reg_write(dev, SOLO_VO_CURSOR_CLR,
(0x80 << 24) | (0x80 << 16) | (0x10 << 8) | 0x80);
solo_reg_write(dev, SOLO_VO_CURSOR_CLR2, (0xe0 << 8) | 0x80);
}
static void solo_vout_config(struct solo_dev *solo_dev)
{
solo_dev->vout_hstart = 6;
solo_dev->vout_vstart = 8;
solo_reg_write(solo_dev, SOLO_VO_BORDER_LINE_COLOR,
(0xa0 << 24) | (0x88 << 16) | (0xa0 << 8) | 0x88);
solo_reg_write(solo_dev, SOLO_VO_BORDER_FILL_COLOR,
(0x10 << 24) | (0x8f << 16) | (0x10 << 8) | 0x8f);
solo_reg_write(solo_dev, SOLO_VO_BKG_COLOR,
(16 << 24) | (128 << 16) | (16 << 8) | 128);
solo_reg_write(solo_dev, SOLO_VO_FMT_ENC,
solo_dev->video_type |
SOLO_VO_USER_COLOR_SET_NAV |
SOLO_VO_USER_COLOR_SET_NAH |
SOLO_VO_NA_COLOR_Y(0) |
SOLO_VO_NA_COLOR_CB(0) |
SOLO_VO_NA_COLOR_CR(0));
......@@ -130,19 +150,31 @@ static void solo_disp_config(struct solo_dev *solo_dev)
SOLO_VO_H_LEN(solo_dev->video_hsize) |
SOLO_VO_V_LEN(solo_dev->video_vsize));
solo_reg_write(solo_dev, SOLO_VI_WIN_SW, 5);
/* Border & background colors */
solo_reg_write(solo_dev, SOLO_VO_BORDER_LINE_COLOR,
(0xa0 << 24) | (0x88 << 16) | (0xa0 << 8) | 0x88);
solo_reg_write(solo_dev, SOLO_VO_BORDER_FILL_COLOR,
(0x10 << 24) | (0x8f << 16) | (0x10 << 8) | 0x8f);
solo_reg_write(solo_dev, SOLO_VO_BKG_COLOR,
(16 << 24) | (128 << 16) | (16 << 8) | 128);
solo_reg_write(solo_dev, SOLO_VO_DISP_ERASE, SOLO_VO_DISP_ERASE_ON);
solo_reg_write(solo_dev, SOLO_VI_WIN_SW, 0);
solo_reg_write(solo_dev, SOLO_VO_ZOOM_CTRL, 0);
solo_reg_write(solo_dev, SOLO_VO_FREEZE_CTRL, 0);
solo_reg_write(solo_dev, SOLO_VO_DISP_CTRL, SOLO_VO_DISP_ON |
SOLO_VO_DISP_ERASE_COUNT(8) |
SOLO_VO_DISP_BASE(SOLO_DISP_EXT_ADDR));
solo_reg_write(solo_dev, SOLO_VO_DISP_ERASE, SOLO_VO_DISP_ERASE_ON);
/* Enable channels we support */
solo_reg_write(solo_dev, SOLO_VI_CH_ENA, (1 << solo_dev->nr_chans) - 1);
solo_vout_config_cursor(solo_dev);
/* Disable the watchdog */
solo_reg_write(solo_dev, SOLO_WATCHDOG, 0);
/* Enable channels we support */
solo_reg_write(solo_dev, SOLO_VI_CH_ENA,
(1 << solo_dev->nr_chans) - 1);
}
static int solo_dma_vin_region(struct solo_dev *solo_dev, u32 off,
......@@ -156,26 +188,53 @@ static int solo_dma_vin_region(struct solo_dev *solo_dev, u32 off,
buf[i] = val;
for (i = 0; i < reg_size; i += sizeof(buf))
ret |= solo_p2m_dma(solo_dev, SOLO_P2M_DMA_ID_VIN, 1, buf,
ret |= solo_p2m_dma(solo_dev, 1, buf,
SOLO_MOTION_EXT_ADDR(solo_dev) + off + i,
sizeof(buf));
sizeof(buf), 0, 0);
return ret;
}
void solo_set_motion_threshold(struct solo_dev *solo_dev, u8 ch, u16 val)
int solo_set_motion_threshold(struct solo_dev *solo_dev, u8 ch, u16 val)
{
if (ch > solo_dev->nr_chans)
return;
return -EINVAL;
solo_dma_vin_region(solo_dev, SOLO_MOT_FLAG_AREA +
(ch * SOLO_MOT_THRESH_SIZE * 2),
val, SOLO_MOT_THRESH_REAL);
return solo_dma_vin_region(solo_dev, SOLO_MOT_FLAG_AREA +
(ch * SOLO_MOT_THRESH_SIZE * 2),
val, SOLO_MOT_THRESH_SIZE);
}
int solo_set_motion_block(struct solo_dev *solo_dev, u8 ch, u16 val,
u16 block)
{
u16 buf[64];
u32 addr;
int re;
addr = SOLO_MOTION_EXT_ADDR(solo_dev) +
SOLO_MOT_FLAG_AREA +
(SOLO_MOT_THRESH_SIZE * 2 * ch) +
(block * 2);
/* Read and write only on a 128-byte boundary; 4-byte writes with
solo_p2m_dma silently failed. Bluecherry bug #908. */
re = solo_p2m_dma(solo_dev, 0, &buf, addr & ~0x7f, sizeof(buf), 0, 0);
if (re)
return re;
buf[(addr & 0x7f) / 2] = val;
re = solo_p2m_dma(solo_dev, 1, &buf, addr & ~0x7f, sizeof(buf), 0, 0);
if (re)
return re;
return 0;
}
/* First 8k is motion flag (512 bytes * 16). Following that is an 8k+8k
* threshold and working table for each channel. Atleast that's what the
* spec says. However, this code (take from rdk) has some mystery 8k
* spec says. However, this code (taken from rdk) has some mystery 8k
* block right after the flag area, before the first thresh table. */
static void solo_motion_config(struct solo_dev *solo_dev)
{
......@@ -188,9 +247,9 @@ static void solo_motion_config(struct solo_dev *solo_dev)
/* Clear working cache table */
solo_dma_vin_region(solo_dev, SOLO_MOT_FLAG_AREA +
SOLO_MOT_THRESH_SIZE +
(i * SOLO_MOT_THRESH_SIZE * 2),
0x0000, SOLO_MOT_THRESH_REAL);
(i * SOLO_MOT_THRESH_SIZE * 2) +
SOLO_MOT_THRESH_SIZE, 0x0000,
SOLO_MOT_THRESH_SIZE);
/* Set default threshold table */
solo_set_motion_threshold(solo_dev, i, SOLO_DEF_MOT_THRESH);
......@@ -202,8 +261,8 @@ static void solo_motion_config(struct solo_dev *solo_dev)
solo_reg_write(solo_dev, SOLO_VI_MOT_CTRL,
SOLO_VI_MOTION_FRAME_COUNT(3) |
SOLO_VI_MOTION_SAMPLE_LENGTH(solo_dev->video_hsize / 16)
| /* SOLO_VI_MOTION_INTR_START_STOP | */
SOLO_VI_MOTION_SAMPLE_COUNT(10));
/* | SOLO_VI_MOTION_INTR_START_STOP */
| SOLO_VI_MOTION_SAMPLE_COUNT(10));
solo_reg_write(solo_dev, SOLO_VI_MOTION_BORDER, 0);
solo_reg_write(solo_dev, SOLO_VI_MOTION_BAR, 0);
......@@ -226,7 +285,7 @@ int solo_disp_init(struct solo_dev *solo_dev)
solo_vin_config(solo_dev);
solo_motion_config(solo_dev);
solo_disp_config(solo_dev);
solo_vout_config(solo_dev);
for (i = 0; i < solo_dev->nr_chans; i++)
solo_reg_write(solo_dev, SOLO_VI_WIN_ON(i), 1);
......@@ -238,8 +297,6 @@ void solo_disp_exit(struct solo_dev *solo_dev)
{
int i;
solo_irq_off(solo_dev, SOLO_IRQ_MOTION);
solo_reg_write(solo_dev, SOLO_VO_DISP_CTRL, 0);
solo_reg_write(solo_dev, SOLO_VO_ZOOM_CTRL, 0);
solo_reg_write(solo_dev, SOLO_VO_FREEZE_CTRL, 0);
......
/*
* Copyright (C) 2010-2013 Bluecherry, LLC <http://www.bluecherrydvr.com>
*
* Original author:
* Ben Collins <bcollins@ubuntu.com>
*
* Additional work by:
* John Brooks <john.brooks@bluecherry.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <linux/kernel.h>
#include <linux/delay.h>
#include "solo6x10.h"
/* Control */
#define EE_SHIFT_CLK 0x04
#define EE_CS 0x08
#define EE_DATA_WRITE 0x02
#define EE_DATA_READ 0x01
#define EE_ENB (0x80 | EE_CS)
#define eeprom_delay() udelay(100)
#if 0
#define eeprom_delay() solo_reg_read(solo_dev, SOLO_EEPROM_CTRL)
#define eeprom_delay() ({ \
int i, ret; \
udelay(100); \
for (i = ret = 0; i < 1000 && !ret; i++) \
ret = solo_eeprom_reg_read(solo_dev); \
})
#endif
#define ADDR_LEN 6
/* Commands */
#define EE_EWEN_CMD 4
#define EE_EWDS_CMD 4
#define EE_WRITE_CMD 5
#define EE_READ_CMD 6
#define EE_ERASE_CMD 7
static unsigned int solo_eeprom_reg_read(struct solo_dev *solo_dev)
{
return solo_reg_read(solo_dev, SOLO_EEPROM_CTRL) & EE_DATA_READ;
}
static void solo_eeprom_reg_write(struct solo_dev *solo_dev, u32 data)
{
solo_reg_write(solo_dev, SOLO_EEPROM_CTRL, data);
eeprom_delay();
}
static void solo_eeprom_cmd(struct solo_dev *solo_dev, int cmd)
{
int i;
solo_eeprom_reg_write(solo_dev, SOLO_EEPROM_ACCESS_EN);
solo_eeprom_reg_write(solo_dev, SOLO_EEPROM_ENABLE);
for (i = 4 + ADDR_LEN; i >= 0; i--) {
int dataval = (cmd & (1 << i)) ? EE_DATA_WRITE : 0;
solo_eeprom_reg_write(solo_dev, SOLO_EEPROM_ENABLE | dataval);
solo_eeprom_reg_write(solo_dev, SOLO_EEPROM_ENABLE |
EE_SHIFT_CLK | dataval);
}
solo_eeprom_reg_write(solo_dev, SOLO_EEPROM_ENABLE);
}
unsigned int solo_eeprom_ewen(struct solo_dev *solo_dev, int w_en)
{
int ewen_cmd = (w_en ? 0x3f : 0) | (EE_EWEN_CMD << ADDR_LEN);
unsigned int retval = 0;
int i;
solo_eeprom_cmd(solo_dev, ewen_cmd);
for (i = 0; i < 16; i++) {
solo_eeprom_reg_write(solo_dev, SOLO_EEPROM_ENABLE |
EE_SHIFT_CLK);
retval = (retval << 1) | solo_eeprom_reg_read(solo_dev);
solo_eeprom_reg_write(solo_dev, SOLO_EEPROM_ENABLE);
retval = (retval << 1) | solo_eeprom_reg_read(solo_dev);
}
solo_eeprom_reg_write(solo_dev, ~EE_CS);
retval = (retval << 1) | solo_eeprom_reg_read(solo_dev);
return retval;
}
unsigned short solo_eeprom_read(struct solo_dev *solo_dev, int loc)
{
int read_cmd = loc | (EE_READ_CMD << ADDR_LEN);
unsigned short retval = 0;
int i;
solo_eeprom_cmd(solo_dev, read_cmd);
for (i = 0; i < 16; i++) {
solo_eeprom_reg_write(solo_dev, SOLO_EEPROM_ENABLE |
EE_SHIFT_CLK);
retval = (retval << 1) | solo_eeprom_reg_read(solo_dev);
solo_eeprom_reg_write(solo_dev, SOLO_EEPROM_ENABLE);
}
solo_eeprom_reg_write(solo_dev, ~EE_CS);
return retval;
}
int solo_eeprom_write(struct solo_dev *solo_dev, int loc,
unsigned short data)
{
int write_cmd = loc | (EE_WRITE_CMD << ADDR_LEN);
unsigned int retval;
int i;
solo_eeprom_cmd(solo_dev, write_cmd);
for (i = 15; i >= 0; i--) {
unsigned int dataval = (data >> i) & 1;
solo_eeprom_reg_write(solo_dev, EE_ENB);
solo_eeprom_reg_write(solo_dev,
EE_ENB | (dataval << 1) | EE_SHIFT_CLK);
}
solo_eeprom_reg_write(solo_dev, EE_ENB);
solo_eeprom_reg_write(solo_dev, ~EE_CS);
solo_eeprom_reg_write(solo_dev, EE_ENB);
for (i = retval = 0; i < 10000 && !retval; i++)
retval = solo_eeprom_reg_read(solo_dev);
solo_eeprom_reg_write(solo_dev, ~EE_CS);
return !retval;
}
This diff is collapsed.
/*
* Copyright (C) 2010 Bluecherry, LLC www.bluecherrydvr.com
* Copyright (C) 2010 Ben Collins <bcollins@bluecherry.net>
* Copyright (C) 2010-2013 Bluecherry, LLC <http://www.bluecherrydvr.com>
*
* Original author:
* Ben Collins <bcollins@ubuntu.com>
*
* Additional work by:
* John Brooks <john.brooks@bluecherry.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -21,17 +26,18 @@
#include <linux/mempool.h>
#include <linux/poll.h>
#include <linux/kthread.h>
#include <linux/slab.h>
#include <linux/freezer.h>
#include <linux/export.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <sound/core.h>
#include <sound/initval.h>
#include <sound/pcm.h>
#include <sound/control.h>
#include "solo6x10.h"
#include "tw28.h"
#define G723_INTR_ORDER 0
#define G723_FDMA_PAGES 32
#define G723_PERIOD_BYTES 48
#define G723_PERIOD_BLOCK 1024
......@@ -46,36 +52,40 @@
/* The solo writes to 1k byte pages, 32 pages, in the dma. Each 1k page
* is broken down to 20 * 48 byte regions (one for each channel possible)
* with the rest of the page being dummy data. */
#define MAX_BUFFER (G723_PERIOD_BYTES * PERIODS_MAX)
#define IRQ_PAGES 4 /* 0 - 4 */
#define PERIODS_MIN (1 << IRQ_PAGES)
#define G723_MAX_BUFFER (G723_PERIOD_BYTES * PERIODS_MAX)
#define G723_INTR_ORDER 4 /* 0 - 4 */
#define PERIODS_MIN (1 << G723_INTR_ORDER)
#define PERIODS_MAX G723_FDMA_PAGES
struct solo_snd_pcm {
int on;
spinlock_t lock;
struct solo_dev *solo_dev;
unsigned char g723_buf[G723_PERIOD_BYTES];
int on;
spinlock_t lock;
struct solo_dev *solo_dev;
unsigned char *g723_buf;
dma_addr_t g723_dma;
};
static void solo_g723_config(struct solo_dev *solo_dev)
{
int clk_div;
clk_div = SOLO_CLOCK_MHZ / (SAMPLERATE * (BITRATE * 2) * 2);
clk_div = (solo_dev->clock_mhz * 1000000)
/ (SAMPLERATE * (BITRATE * 2) * 2);
solo_reg_write(solo_dev, SOLO_AUDIO_SAMPLE,
SOLO_AUDIO_BITRATE(BITRATE) |
SOLO_AUDIO_CLK_DIV(clk_div));
SOLO_AUDIO_BITRATE(BITRATE)
| SOLO_AUDIO_CLK_DIV(clk_div));
solo_reg_write(solo_dev, SOLO_AUDIO_FDMA_INTR,
SOLO_AUDIO_FDMA_INTERVAL(IRQ_PAGES) |
SOLO_AUDIO_INTR_ORDER(G723_INTR_ORDER) |
SOLO_AUDIO_FDMA_BASE(SOLO_G723_EXT_ADDR(solo_dev) >> 16));
SOLO_AUDIO_FDMA_INTERVAL(1)
| SOLO_AUDIO_INTR_ORDER(G723_INTR_ORDER)
| SOLO_AUDIO_FDMA_BASE(SOLO_G723_EXT_ADDR(solo_dev) >> 16));
solo_reg_write(solo_dev, SOLO_AUDIO_CONTROL,
SOLO_AUDIO_ENABLE | SOLO_AUDIO_I2S_MODE |
SOLO_AUDIO_I2S_MULTI(3) | SOLO_AUDIO_MODE(OUTMODE_MASK));
SOLO_AUDIO_ENABLE
| SOLO_AUDIO_I2S_MODE
| SOLO_AUDIO_I2S_MULTI(3)
| SOLO_AUDIO_MODE(OUTMODE_MASK));
}
void solo_g723_isr(struct solo_dev *solo_dev)
......@@ -85,8 +95,6 @@ void solo_g723_isr(struct solo_dev *solo_dev)
struct snd_pcm_substream *ss;
struct solo_snd_pcm *solo_pcm;
solo_reg_write(solo_dev, SOLO_IRQ_STAT, SOLO_IRQ_G723);
for (ss = pstr->substream; ss != NULL; ss = ss->next) {
if (snd_pcm_substream_chip(ss) == NULL)
continue;
......@@ -115,18 +123,18 @@ static int snd_solo_hw_free(struct snd_pcm_substream *ss)
return snd_pcm_lib_free_pages(ss);
}
static struct snd_pcm_hardware snd_solo_pcm_hw = {
static const struct snd_pcm_hardware snd_solo_pcm_hw = {
.info = (SNDRV_PCM_INFO_MMAP |
SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_BLOCK_TRANSFER |
SNDRV_PCM_INFO_MMAP_VALID),
.formats = SNDRV_PCM_FMTBIT_U8,
.rates = SNDRV_PCM_RATE_8000,
.rate_min = 8000,
.rate_max = 8000,
.rate_min = SAMPLERATE,
.rate_max = SAMPLERATE,
.channels_min = 1,
.channels_max = 1,
.buffer_bytes_max = MAX_BUFFER,
.buffer_bytes_max = G723_MAX_BUFFER,
.period_bytes_min = G723_PERIOD_BYTES,
.period_bytes_max = G723_PERIOD_BYTES,
.periods_min = PERIODS_MIN,
......@@ -140,7 +148,13 @@ static int snd_solo_pcm_open(struct snd_pcm_substream *ss)
solo_pcm = kzalloc(sizeof(*solo_pcm), GFP_KERNEL);
if (solo_pcm == NULL)
return -ENOMEM;
goto oom;
solo_pcm->g723_buf = pci_alloc_consistent(solo_dev->pdev,
G723_PERIOD_BYTES,
&solo_pcm->g723_dma);
if (solo_pcm->g723_buf == NULL)
goto oom;
spin_lock_init(&solo_pcm->lock);
solo_pcm->solo_dev = solo_dev;
......@@ -149,6 +163,10 @@ static int snd_solo_pcm_open(struct snd_pcm_substream *ss)
snd_pcm_substream_chip(ss) = solo_pcm;
return 0;
oom:
kfree(solo_pcm);
return -ENOMEM;
}
static int snd_solo_pcm_close(struct snd_pcm_substream *ss)
......@@ -156,6 +174,8 @@ static int snd_solo_pcm_close(struct snd_pcm_substream *ss)
struct solo_snd_pcm *solo_pcm = snd_pcm_substream_chip(ss);
snd_pcm_substream_chip(ss) = solo_pcm->solo_dev;
pci_free_consistent(solo_pcm->solo_dev->pdev, G723_PERIOD_BYTES,
solo_pcm->g723_buf, solo_pcm->g723_dma);
kfree(solo_pcm);
return 0;
......@@ -220,12 +240,11 @@ static int snd_solo_pcm_copy(struct snd_pcm_substream *ss, int channel,
for (i = 0; i < (count / G723_FRAMES_PER_PAGE); i++) {
int page = (pos / G723_FRAMES_PER_PAGE) + i;
err = solo_p2m_dma(solo_dev, SOLO_P2M_DMA_ID_G723E, 0,
solo_pcm->g723_buf,
SOLO_G723_EXT_ADDR(solo_dev) +
(page * G723_PERIOD_BLOCK) +
(ss->number * G723_PERIOD_BYTES),
G723_PERIOD_BYTES);
err = solo_p2m_dma_t(solo_dev, 0, solo_pcm->g723_dma,
SOLO_G723_EXT_ADDR(solo_dev) +
(page * G723_PERIOD_BLOCK) +
(ss->number * G723_PERIOD_BYTES),
G723_PERIOD_BYTES, 0, 0);
if (err)
return err;
......@@ -325,7 +344,7 @@ static int solo_snd_pcm_init(struct solo_dev *solo_dev)
ret = snd_pcm_lib_preallocate_pages_for_all(pcm,
SNDRV_DMA_TYPE_CONTINUOUS,
snd_dma_continuous_data(GFP_KERNEL),
MAX_BUFFER, MAX_BUFFER);
G723_MAX_BUFFER, G723_MAX_BUFFER);
if (ret < 0)
return ret;
......@@ -368,6 +387,7 @@ int solo_g723_init(struct solo_dev *solo_dev)
strcpy(card->mixername, "SOLO-6x10");
kctl = snd_solo_capture_volume;
kctl.count = solo_dev->nr_chans;
ret = snd_ctl_add(card, snd_ctl_new1(&kctl, solo_dev));
if (ret < 0)
return ret;
......@@ -393,8 +413,12 @@ int solo_g723_init(struct solo_dev *solo_dev)
void solo_g723_exit(struct solo_dev *solo_dev)
{
if (!solo_dev->snd_card)
return;
solo_reg_write(solo_dev, SOLO_AUDIO_CONTROL, 0);
solo_irq_off(solo_dev, SOLO_IRQ_G723);
snd_card_free(solo_dev->snd_card);
solo_dev->snd_card = NULL;
}
/*
* Copyright (C) 2010 Bluecherry, LLC www.bluecherrydvr.com
* Copyright (C) 2010 Ben Collins <bcollins@bluecherry.net>
* Copyright (C) 2010-2013 Bluecherry, LLC <http://www.bluecherrydvr.com>
*
* Original author:
* Ben Collins <bcollins@ubuntu.com>
*
* Additional work by:
* John Brooks <john.brooks@bluecherry.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -19,7 +24,9 @@
#include <linux/kernel.h>
#include <linux/fs.h>
#include <asm/uaccess.h>
#include <linux/delay.h>
#include <linux/uaccess.h>
#include "solo6x10.h"
static void solo_gpio_mode(struct solo_dev *solo_dev,
......
/*
* Copyright (C) 2010 Bluecherry, LLC www.bluecherrydvr.com
* Copyright (C) 2010 Ben Collins <bcollins@bluecherry.net>
* Copyright (C) 2010-2013 Bluecherry, LLC <http://www.bluecherrydvr.com>
*
* Original author:
* Ben Collins <bcollins@ubuntu.com>
*
* Additional work by:
* John Brooks <john.brooks@bluecherry.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -26,6 +31,7 @@
* thread context, ACK the interrupt, and move on. -- BenC */
#include <linux/kernel.h>
#include "solo6x10.h"
u8 solo_i2c_readbyte(struct solo_dev *solo_dev, int id, u8 addr, u8 off)
......@@ -173,10 +179,9 @@ int solo_i2c_isr(struct solo_dev *solo_dev)
u32 status = solo_reg_read(solo_dev, SOLO_IIC_CTRL);
int ret = -EINVAL;
solo_reg_write(solo_dev, SOLO_IRQ_STAT, SOLO_IRQ_IIC);
if (status & (SOLO_IIC_STATE_TRNS | SOLO_IIC_STATE_SIG_ERR) ||
solo_dev->i2c_id < 0) {
if (CHK_FLAGS(status, SOLO_IIC_STATE_TRNS | SOLO_IIC_STATE_SIG_ERR)
|| solo_dev->i2c_id < 0) {
solo_i2c_stop(solo_dev);
return -ENXIO;
}
......@@ -239,7 +244,8 @@ static int solo_i2c_master_xfer(struct i2c_adapter *adap,
timeout = HZ / 2;
for (;;) {
prepare_to_wait(&solo_dev->i2c_wait, &wait, TASK_INTERRUPTIBLE);
prepare_to_wait(&solo_dev->i2c_wait, &wait,
TASK_INTERRUPTIBLE);
if (solo_dev->i2c_state == IIC_STATE_STOP)
break;
......@@ -267,7 +273,7 @@ static u32 solo_i2c_functionality(struct i2c_adapter *adap)
return I2C_FUNC_I2C;
}
static struct i2c_algorithm solo_i2c_algo = {
static const struct i2c_algorithm solo_i2c_algo = {
.master_xfer = solo_i2c_master_xfer,
.functionality = solo_i2c_functionality,
};
......@@ -288,7 +294,8 @@ int solo_i2c_init(struct solo_dev *solo_dev)
for (i = 0; i < SOLO_I2C_ADAPTERS; i++) {
struct i2c_adapter *adap = &solo_dev->i2c_adap[i];
snprintf(adap->name, I2C_NAME_SIZE, "%s I2C %d", SOLO6X10_NAME, i);
snprintf(adap->name, I2C_NAME_SIZE, "%s I2C %d",
SOLO6X10_NAME, i);
adap->algo = &solo_i2c_algo;
adap->algo_data = solo_dev;
adap->retries = 1;
......@@ -311,9 +318,6 @@ int solo_i2c_init(struct solo_dev *solo_dev)
return ret;
}
dev_info(&solo_dev->pdev->dev, "Enabled %d i2c adapters\n",
SOLO_I2C_ADAPTERS);
return 0;
}
......
/*
* Copyright (C) 2010 Bluecherry, LLC www.bluecherrydvr.com
* Copyright (C) 2010 Ben Collins <bcollins@bluecherry.net>
* Copyright (C) 2010-2013 Bluecherry, LLC <http://www.bluecherrydvr.com>
*
* Original author:
* Ben Collins <bcollins@ubuntu.com>
*
* Additional work by:
* John Brooks <john.brooks@bluecherry.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -20,55 +25,61 @@
#ifndef __SOLO6X10_OFFSETS_H
#define __SOLO6X10_OFFSETS_H
/* Offsets and sizes of the external address */
#define SOLO_DISP_EXT_ADDR 0x00000000
#define SOLO_DISP_EXT_SIZE 0x00480000
#define SOLO_DEC2LIVE_EXT_ADDR (SOLO_DISP_EXT_ADDR + SOLO_DISP_EXT_SIZE)
#define SOLO_DEC2LIVE_EXT_SIZE 0x00240000
#define SOLO_OSG_EXT_ADDR (SOLO_DEC2LIVE_EXT_ADDR + SOLO_DEC2LIVE_EXT_SIZE)
#define SOLO_OSG_EXT_SIZE 0x00120000
#define SOLO_EOSD_EXT_ADDR \
(SOLO_DISP_EXT_ADDR + SOLO_DISP_EXT_SIZE)
#define SOLO_EOSD_EXT_SIZE(__solo) \
(__solo->type == SOLO_DEV_6010 ? 0x10000 : 0x20000)
#define SOLO_EOSD_EXT_SIZE_MAX 0x20000
#define SOLO_EOSD_EXT_AREA(__solo) \
(SOLO_EOSD_EXT_SIZE(__solo) * 32)
#define SOLO_EOSD_EXT_ADDR (SOLO_OSG_EXT_ADDR + SOLO_OSG_EXT_SIZE)
#define SOLO_EOSD_EXT_SIZE 0x00010000
#define SOLO_MOTION_EXT_ADDR(__solo) (SOLO_EOSD_EXT_ADDR + \
(SOLO_EOSD_EXT_SIZE * __solo->nr_chans))
#define SOLO_MOTION_EXT_ADDR(__solo) \
(SOLO_EOSD_EXT_ADDR + SOLO_EOSD_EXT_AREA(__solo))
#define SOLO_MOTION_EXT_SIZE 0x00080000
#define SOLO_G723_EXT_ADDR(__solo) \
(SOLO_MOTION_EXT_ADDR(__solo) + SOLO_MOTION_EXT_SIZE)
(SOLO_MOTION_EXT_ADDR(__solo) + SOLO_MOTION_EXT_SIZE)
#define SOLO_G723_EXT_SIZE 0x00010000
#define SOLO_CAP_EXT_ADDR(__solo) \
(SOLO_G723_EXT_ADDR(__solo) + SOLO_G723_EXT_SIZE)
#define SOLO_CAP_EXT_MAX_PAGE (18 + 15)
#define SOLO_CAP_EXT_SIZE (SOLO_CAP_EXT_MAX_PAGE * 65536)
(SOLO_G723_EXT_ADDR(__solo) + SOLO_G723_EXT_SIZE)
/* 18 is the maximum number of pages required for PAL@D1, the largest frame
* possible */
#define SOLO_CAP_PAGE_SIZE (18 << 16)
/* Always allow the encoder enough for 16 channels, even if we have less. The
* exception is if we have card with only 32Megs of memory. */
#define SOLO_CAP_EXT_SIZE(__solo) \
((((__solo->sdram_size <= (32 << 20)) ? 4 : 16) + 1) \
* SOLO_CAP_PAGE_SIZE)
/* This +1 is very important -- Why?! -- BenC */
#define SOLO_EREF_EXT_ADDR(__solo) \
(SOLO_CAP_EXT_ADDR(__solo) + \
(SOLO_CAP_EXT_SIZE * (__solo->nr_chans + 1)))
(SOLO_CAP_EXT_ADDR(__solo) + SOLO_CAP_EXT_SIZE(__solo))
#define SOLO_EREF_EXT_SIZE 0x00140000
#define SOLO_EREF_EXT_AREA(__solo) \
(SOLO_EREF_EXT_SIZE * __solo->nr_chans * 2)
#define __SOLO_JPEG_MIN_SIZE(__solo) (__solo->nr_chans * 0x00080000)
#define SOLO_MP4E_EXT_ADDR(__solo) \
(SOLO_EREF_EXT_ADDR(__solo) + \
(SOLO_EREF_EXT_SIZE * __solo->nr_chans))
#define SOLO_MP4E_EXT_SIZE(__solo) (0x00080000 * __solo->nr_chans)
(SOLO_EREF_EXT_ADDR(__solo) + SOLO_EREF_EXT_AREA(__solo))
#define SOLO_MP4E_EXT_SIZE(__solo) \
max((__solo->nr_chans * 0x00080000), \
min(((__solo->sdram_size - SOLO_MP4E_EXT_ADDR(__solo)) - \
__SOLO_JPEG_MIN_SIZE(__solo)), 0x00ff0000))
#define SOLO_DREF_EXT_ADDR(__solo) \
#define __SOLO_JPEG_MIN_SIZE(__solo) (__solo->nr_chans * 0x00080000)
#define SOLO_JPEG_EXT_ADDR(__solo) \
(SOLO_MP4E_EXT_ADDR(__solo) + SOLO_MP4E_EXT_SIZE(__solo))
#define SOLO_DREF_EXT_SIZE 0x00140000
#define SOLO_JPEG_EXT_SIZE(__solo) \
max(__SOLO_JPEG_MIN_SIZE(__solo), \
min((__solo->sdram_size - SOLO_JPEG_EXT_ADDR(__solo)), 0x00ff0000))
#define SOLO_MP4D_EXT_ADDR(__solo) \
(SOLO_DREF_EXT_ADDR(__solo) + \
(SOLO_DREF_EXT_SIZE * __solo->nr_chans))
#define SOLO_MP4D_EXT_SIZE 0x00080000
#define SOLO_JPEG_EXT_ADDR(__solo) \
(SOLO_MP4D_EXT_ADDR(__solo) + \
(SOLO_MP4D_EXT_SIZE * __solo->nr_chans))
#define SOLO_JPEG_EXT_SIZE(__solo) (0x00080000 * __solo->nr_chans)
#define SOLO_SDRAM_END(__solo) \
(SOLO_JPEG_EXT_ADDR(__solo) + SOLO_JPEG_EXT_SIZE(__solo))
#endif /* __SOLO6X10_OFFSETS_H */
/*
* Copyright (C) 2010 Bluecherry, LLC www.bluecherrydvr.com
* Copyright (C) 2010 Ben Collins <bcollins@bluecherry.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __SOLO6X10_OSD_FONT_H
#define __SOLO6X10_OSD_FONT_H
static const unsigned int solo_osd_font[] = {
0x00000000, 0x0000c0c8, 0xccfefe0c, 0x08000000,
0x00000000, 0x10103838, 0x7c7cfefe, 0x00000000, /* 0 */
0x00000000, 0xfefe7c7c, 0x38381010, 0x10000000,
0x00000000, 0x7c82fefe, 0xfefefe7c, 0x00000000,
0x00000000, 0x00001038, 0x10000000, 0x00000000,
0x00000000, 0x0010387c, 0xfe7c3810, 0x00000000,
0x00000000, 0x00384444, 0x44380000, 0x00000000,
0x00000000, 0x38448282, 0x82443800, 0x00000000,
0x00000000, 0x007c7c7c, 0x7c7c0000, 0x00000000,
0x00000000, 0x6c6c6c6c, 0x6c6c6c6c, 0x00000000,
0x00000000, 0x061e7efe, 0xfe7e1e06, 0x00000000,
0x00000000, 0xc0f0fcfe, 0xfefcf0c0, 0x00000000,
0x00000000, 0xc6cedefe, 0xfedecec6, 0x00000000,
0x00000000, 0xc6e6f6fe, 0xfef6e6c6, 0x00000000,
0x00000000, 0x12367efe, 0xfe7e3612, 0x00000000,
0x00000000, 0x90d8fcfe, 0xfefcd890, 0x00000000,
0x00000038, 0x7cc692ba, 0x92c67c38, 0x00000000,
0x00000038, 0x7cc6aa92, 0xaac67c38, 0x00000000,
0x00000038, 0x7830107c, 0xbaa8680c, 0x00000000,
0x00000038, 0x3c18127c, 0xb8382c60, 0x00000000,
0x00000044, 0xaa6c8254, 0x38eec67c, 0x00000000,
0x00000082, 0x44288244, 0x38c6827c, 0x00000000,
0x00000038, 0x444444fe, 0xfeeec6fe, 0x00000000,
0x00000018, 0x78187818, 0x3c7e7e3c, 0x00000000,
0x00000000, 0x3854929a, 0x82443800, 0x00000000,
0x00000000, 0x00c0c8cc, 0xfefe0c08, 0x00000000,
0x0000e0a0, 0xe040e00e, 0x8a0ea40e, 0x00000000,
0x0000e0a0, 0xe040e00e, 0x0a8e440e, 0x00000000,
0x0000007c, 0x82829292, 0x929282fe, 0x00000000,
0x000000f8, 0xfc046494, 0x946404fc, 0x00000000,
0x0000003f, 0x7f404c52, 0x524c407f, 0x00000000,
0x0000007c, 0x82ba82ba, 0x82ba82fe, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x183c3c3c, 0x18180018, 0x18000000, /* 32 ! */
0x00000066, 0x66240000, 0x00000000, 0x00000000,
0x00000000, 0x6c6cfe6c, 0x6c6cfe6c, 0x6c000000, /* 34 " # */
0x00001010, 0x7cd6d616, 0x7cd0d6d6, 0x7c101000,
0x00000000, 0x0086c660, 0x30180cc6, 0xc2000000, /* 36 $ % */
0x00000000, 0x386c6c38, 0xdc766666, 0xdc000000,
0x0000000c, 0x0c0c0600, 0x00000000, 0x00000000, /* 38 & ' */
0x00000000, 0x30180c0c, 0x0c0c0c18, 0x30000000,
0x00000000, 0x0c183030, 0x30303018, 0x0c000000, /* 40 ( ) */
0x00000000, 0x0000663c, 0xff3c6600, 0x00000000,
0x00000000, 0x00001818, 0x7e181800, 0x00000000, /* 42 * + */
0x00000000, 0x00000000, 0x00000e0e, 0x0c060000,
0x00000000, 0x00000000, 0x7e000000, 0x00000000, /* 44 , - */
0x00000000, 0x00000000, 0x00000006, 0x06000000,
0x00000000, 0x80c06030, 0x180c0602, 0x00000000, /* 46 . / */
0x0000007c, 0xc6e6f6de, 0xcec6c67c, 0x00000000,
0x00000030, 0x383c3030, 0x303030fc, 0x00000000, /* 48 0 1 */
0x0000007c, 0xc6c06030, 0x180cc6fe, 0x00000000,
0x0000007c, 0xc6c0c07c, 0xc0c0c67c, 0x00000000, /* 50 2 3 */
0x00000060, 0x70786c66, 0xfe6060f0, 0x00000000,
0x000000fe, 0x0606067e, 0xc0c0c67c, 0x00000000, /* 52 4 5 */
0x00000038, 0x0c06067e, 0xc6c6c67c, 0x00000000,
0x000000fe, 0xc6c06030, 0x18181818, 0x00000000, /* 54 6 7 */
0x0000007c, 0xc6c6c67c, 0xc6c6c67c, 0x00000000,
0x0000007c, 0xc6c6c6fc, 0xc0c06038, 0x00000000, /* 56 8 9 */
0x00000000, 0x18180000, 0x00181800, 0x00000000,
0x00000000, 0x18180000, 0x0018180c, 0x00000000, /* 58 : ; */
0x00000060, 0x30180c06, 0x0c183060, 0x00000000,
0x00000000, 0x007e0000, 0x007e0000, 0x00000000,
0x00000006, 0x0c183060, 0x30180c06, 0x00000000,
0x0000007c, 0xc6c66030, 0x30003030, 0x00000000,
0x0000007c, 0xc6f6d6d6, 0x7606067c, 0x00000000,
0x00000010, 0x386cc6c6, 0xfec6c6c6, 0x00000000, /* 64 @ A */
0x0000007e, 0xc6c6c67e, 0xc6c6c67e, 0x00000000,
0x00000078, 0xcc060606, 0x0606cc78, 0x00000000, /* 66 */
0x0000003e, 0x66c6c6c6, 0xc6c6663e, 0x00000000,
0x000000fe, 0x0606063e, 0x060606fe, 0x00000000, /* 68 */
0x000000fe, 0x0606063e, 0x06060606, 0x00000000,
0x00000078, 0xcc060606, 0xf6c6ccb8, 0x00000000, /* 70 */
0x000000c6, 0xc6c6c6fe, 0xc6c6c6c6, 0x00000000,
0x0000003c, 0x18181818, 0x1818183c, 0x00000000, /* 72 */
0x00000060, 0x60606060, 0x6066663c, 0x00000000,
0x000000c6, 0xc666361e, 0x3666c6c6, 0x00000000, /* 74 */
0x00000006, 0x06060606, 0x060606fe, 0x00000000,
0x000000c6, 0xeefed6c6, 0xc6c6c6c6, 0x00000000, /* 76 */
0x000000c6, 0xcedefef6, 0xe6c6c6c6, 0x00000000,
0x00000038, 0x6cc6c6c6, 0xc6c66c38, 0x00000000, /* 78 */
0x0000007e, 0xc6c6c67e, 0x06060606, 0x00000000,
0x00000038, 0x6cc6c6c6, 0xc6d67c38, 0x60000000, /* 80 */
0x0000007e, 0xc6c6c67e, 0x66c6c6c6, 0x00000000,
0x0000007c, 0xc6c60c38, 0x60c6c67c, 0x00000000, /* 82 */
0x0000007e, 0x18181818, 0x18181818, 0x00000000,
0x000000c6, 0xc6c6c6c6, 0xc6c6c67c, 0x00000000, /* 84 */
0x000000c6, 0xc6c6c6c6, 0xc66c3810, 0x00000000,
0x000000c6, 0xc6c6c6c6, 0xd6d6fe6c, 0x00000000, /* 86 */
0x000000c6, 0xc6c66c38, 0x6cc6c6c6, 0x00000000,
0x00000066, 0x66666666, 0x3c181818, 0x00000000, /* 88 */
0x000000fe, 0xc0603018, 0x0c0606fe, 0x00000000,
0x0000003c, 0x0c0c0c0c, 0x0c0c0c3c, 0x00000000, /* 90 */
0x00000002, 0x060c1830, 0x60c08000, 0x00000000,
0x0000003c, 0x30303030, 0x3030303c, 0x00000000, /* 92 */
0x00001038, 0x6cc60000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00fe0000,
0x00001818, 0x30000000, 0x00000000, 0x00000000,
0x00000000, 0x00003c60, 0x7c66667c, 0x00000000,
0x0000000c, 0x0c0c7ccc, 0xcccccc7c, 0x00000000,
0x00000000, 0x00007cc6, 0x0606c67c, 0x00000000,
0x00000060, 0x60607c66, 0x6666667c, 0x00000000,
0x00000000, 0x00007cc6, 0xfe06c67c, 0x00000000,
0x00000078, 0x0c0c0c3e, 0x0c0c0c0c, 0x00000000,
0x00000000, 0x00007c66, 0x6666667c, 0x60603e00,
0x0000000c, 0x0c0c7ccc, 0xcccccccc, 0x00000000,
0x00000030, 0x30003830, 0x30303078, 0x00000000,
0x00000030, 0x30003c30, 0x30303030, 0x30301f00,
0x0000000c, 0x0c0ccc6c, 0x3c6ccccc, 0x00000000,
0x00000030, 0x30303030, 0x30303030, 0x00000000,
0x00000000, 0x000066fe, 0xd6d6d6d6, 0x00000000,
0x00000000, 0x000078cc, 0xcccccccc, 0x00000000,
0x00000000, 0x00007cc6, 0xc6c6c67c, 0x00000000,
0x00000000, 0x00007ccc, 0xcccccc7c, 0x0c0c0c00,
0x00000000, 0x00007c66, 0x6666667c, 0x60606000,
0x00000000, 0x000076dc, 0x0c0c0c0c, 0x00000000,
0x00000000, 0x00007cc6, 0x1c70c67c, 0x00000000,
0x00000000, 0x1818fe18, 0x18181870, 0x00000000,
0x00000000, 0x00006666, 0x6666663c, 0x00000000,
0x00000000, 0x0000c6c6, 0xc66c3810, 0x00000000,
0x00000000, 0x0000c6d6, 0xd6d6fe6c, 0x00000000,
0x00000000, 0x0000c66c, 0x38386cc6, 0x00000000,
0x00000000, 0x00006666, 0x6666667c, 0x60603e00,
0x00000000, 0x0000fe60, 0x30180cfe, 0x00000000,
0x00000070, 0x1818180e, 0x18181870, 0x00000000,
0x00000018, 0x18181800, 0x18181818, 0x00000000,
0x0000000e, 0x18181870, 0x1818180e, 0x00000000,
0x000000dc, 0x76000000, 0x00000000, 0x00000000,
0x00000000, 0x0010386c, 0xc6c6fe00, 0x00000000
};
#endif /* __SOLO6X10_OSD_FONT_H */
This diff is collapsed.
/*
* Copyright (C) 2010 Bluecherry, LLC www.bluecherrydvr.com
* Copyright (C) 2010 Ben Collins <bcollins@bluecherry.net>
* Copyright (C) 2010-2013 Bluecherry, LLC <http://www.bluecherrydvr.com>
*
* Original author:
* Ben Collins <bcollins@ubuntu.com>
*
* Additional work by:
* John Brooks <john.brooks@bluecherry.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -22,18 +27,18 @@
#include "offsets.h"
/* Global 6X10 system configuration */
/* Global 6010 system configuration */
#define SOLO_SYS_CFG 0x0000
#define SOLO6010_SYS_CFG_FOUT_EN 0x00000001 /* 6010 only */
#define SOLO6010_SYS_CFG_PLL_BYPASS 0x00000002 /* 6010 only */
#define SOLO6010_SYS_CFG_PLL_PWDN 0x00000004 /* 6010 only */
#define SOLO6010_SYS_CFG_OUTDIV(__n) (((__n) & 0x003) << 3) /* 6010 only */
#define SOLO6010_SYS_CFG_FEEDBACKDIV(__n) (((__n) & 0x1ff) << 5) /* 6010 only */
#define SOLO6010_SYS_CFG_INPUTDIV(__n) (((__n) & 0x01f) << 14) /* 6010 only */
#define SOLO_SYS_CFG_FOUT_EN 0x00000001
#define SOLO_SYS_CFG_PLL_BYPASS 0x00000002
#define SOLO_SYS_CFG_PLL_PWDN 0x00000004
#define SOLO_SYS_CFG_OUTDIV(__n) (((__n) & 0x003) << 3)
#define SOLO_SYS_CFG_FEEDBACKDIV(__n) (((__n) & 0x1ff) << 5)
#define SOLO_SYS_CFG_INPUTDIV(__n) (((__n) & 0x01f) << 14)
#define SOLO_SYS_CFG_CLOCK_DIV 0x00080000
#define SOLO_SYS_CFG_NCLK_DELAY(__n) (((__n) & 0x003) << 24)
#define SOLO_SYS_CFG_PCLK_DELAY(__n) (((__n) & 0x00f) << 26)
#define SOLO_SYS_CFG_SDRAM64BIT 0x40000000 /* 6110: must be set */
#define SOLO_SYS_CFG_SDRAM64BIT 0x40000000
#define SOLO_SYS_CFG_RESET 0x80000000
#define SOLO_DMA_CTRL 0x0004
......@@ -45,7 +50,9 @@
#define SOLO_DMA_CTRL_READ_DATA_SELECT (1<<3)
#define SOLO_DMA_CTRL_READ_CLK_SELECT (1<<2)
#define SOLO_DMA_CTRL_LATENCY(n) ((n)<<0)
#define SOLO_DMA_CTRL1 0x0008
/* Some things we set in this are undocumented. Why Softlogic?!?! */
#define SOLO_DMA_CTRL1 0x0008
#define SOLO_SYS_VCLK 0x000C
#define SOLO_VCLK_INVERT (1<<22)
......@@ -61,7 +68,7 @@
#define SOLO_VCLK_VIN0001_DELAY(n) ((n)<<0)
#define SOLO_IRQ_STAT 0x0010
#define SOLO_IRQ_ENABLE 0x0014
#define SOLO_IRQ_MASK 0x0014
#define SOLO_IRQ_P2M(n) (1<<((n)+17))
#define SOLO_IRQ_GPIO (1<<16)
#define SOLO_IRQ_VIDEO_LOSS (1<<15)
......@@ -82,22 +89,7 @@
#define SOLO_CHIP_OPTION 0x001C
#define SOLO_CHIP_ID_MASK 0x00000007
#define SOLO6110_PLL_CONFIG 0x0020
#define SOLO6110_PLL_RANGE_BYPASS (0 << 20)
#define SOLO6110_PLL_RANGE_5_10MHZ (1 << 20)
#define SOLO6110_PLL_RANGE_8_16MHZ (2 << 20)
#define SOLO6110_PLL_RANGE_13_26MHZ (3 << 20)
#define SOLO6110_PLL_RANGE_21_42MHZ (4 << 20)
#define SOLO6110_PLL_RANGE_34_68MHZ (5 << 20)
#define SOLO6110_PLL_RANGE_54_108MHZ (6 << 20)
#define SOLO6110_PLL_RANGE_88_200MHZ (7 << 20)
#define SOLO6110_PLL_DIVR(x) (((x) - 1) << 15)
#define SOLO6110_PLL_DIVQ_EXP(x) ((x) << 12)
#define SOLO6110_PLL_DIVF(x) (((x) - 1) << 4)
#define SOLO6110_PLL_RESET (1 << 3)
#define SOLO6110_PLL_BYPASS (1 << 2)
#define SOLO6110_PLL_FSEN (1 << 1)
#define SOLO6110_PLL_FB (1 << 0)
#define SOLO_PLL_CONFIG 0x0020 /* 6110 Only */
#define SOLO_EEPROM_CTRL 0x0060
#define SOLO_EEPROM_ACCESS_EN (1<<7)
......@@ -105,7 +97,7 @@
#define SOLO_EEPROM_CLK (1<<2)
#define SOLO_EEPROM_DO (1<<1)
#define SOLO_EEPROM_DI (1<<0)
#define SOLO_EEPROM_ENABLE (EEPROM_ACCESS_EN | EEPROM_CS)
#define SOLO_EEPROM_ENABLE (SOLO_EEPROM_ACCESS_EN | SOLO_EEPROM_CS)
#define SOLO_PCI_ERR 0x0070
#define SOLO_PCI_ERR_FATAL 0x00000001
......@@ -274,8 +266,8 @@
#define SOLO_VO_FI_CHANGE (1<<20)
#define SOLO_VO_USER_COLOR_SET_VSYNC (1<<19)
#define SOLO_VO_USER_COLOR_SET_HSYNC (1<<18)
#define SOLO_VO_USER_COLOR_SET_NAV (1<<17)
#define SOLO_VO_USER_COLOR_SET_NAH (1<<16)
#define SOLO_VO_USER_COLOR_SET_NAH (1<<17)
#define SOLO_VO_USER_COLOR_SET_NAV (1<<16)
#define SOLO_VO_NA_COLOR_Y(Y) ((Y)<<8)
#define SOLO_VO_NA_COLOR_CB(CB) (((CB)/16)<<4)
#define SOLO_VO_NA_COLOR_CR(CR) (((CR)/16)<<0)
......@@ -401,12 +393,13 @@
#define SOLO_VE_BLOCK_BASE(n) ((n)<<0)
#define SOLO_VE_CFG1 0x0614
#define SOLO6110_VE_MPEG_SIZE_H(n) ((n)<<28) /* 6110 only */
#define SOLO6010_VE_BYTE_ALIGN(n) ((n)<<24) /* 6010 only */
#define SOLO6110_VE_JPEG_SIZE_H(n) ((n)<<20) /* 6110 only */
#define SOLO_VE_BYTE_ALIGN(n) ((n)<<24)
#define SOLO_VE_INSERT_INDEX (1<<18)
#define SOLO_VE_MOTION_MODE(n) ((n)<<16)
#define SOLO_VE_MOTION_BASE(n) ((n)<<0)
#define SOLO_VE_MPEG_SIZE_H(n) ((n)<<28) /* 6110 Only */
#define SOLO_VE_JPEG_SIZE_H(n) ((n)<<20) /* 6110 Only */
#define SOLO_VE_INSERT_INDEX_JPEG (1<<19) /* 6110 Only */
#define SOLO_VE_WMRK_POLY 0x061C
#define SOLO_VE_VMRK_INIT_KEY 0x0620
......@@ -420,6 +413,7 @@
#define SOLO_COMP_TIME_INC(n) ((n)<<25)
#define SOLO_COMP_TIME_WIDTH(n) ((n)<<21)
#define SOLO_DCT_INTERVAL(n) ((n)<<16)
#define SOLO_VE_COMPT_MOT 0x0634 /* 6110 Only */
#define SOLO_VE_STATE(n) (0x0640+((n)*4))
......@@ -428,14 +422,21 @@
#define SOLO_VE_JPEG_QP_CH_H 0x0678
#define SOLO_VE_JPEG_CFG 0x067C
#define SOLO_VE_JPEG_CTRL 0x0680
#define SOLO_VE_CODE_ENCRYPT 0x0684 /* 6110 Only */
#define SOLO_VE_JPEG_CFG1 0x0688 /* 6110 Only */
#define SOLO_VE_WMRK_ENABLE 0x068C /* 6110 Only */
#define SOLO_VE_OSD_CH 0x0690
#define SOLO_VE_OSD_BASE 0x0694
#define SOLO_VE_OSD_CLR 0x0698
#define SOLO_VE_OSD_OPT 0x069C
#define SOLO_VE_OSD_V_DOUBLE (1<<16) /* 6110 Only */
#define SOLO_VE_OSD_H_SHADOW (1<<15)
#define SOLO_VE_OSD_V_SHADOW (1<<14)
#define SOLO_VE_OSD_H_OFFSET(n) ((n & 0x7f)<<7)
#define SOLO_VE_OSD_V_OFFSET(n) (n & 0x7f)
#define SOLO_VE_CH_INTL(ch) (0x0700+((ch)*4))
#define SOLO6010_VE_CH_MOT(ch) (0x0740+((ch)*4)) /* 6010 only */
#define SOLO_VE_CH_MOT(ch) (0x0740+((ch)*4))
#define SOLO_VE_CH_QP(ch) (0x0780+((ch)*4))
#define SOLO_VE_CH_QP_E(ch) (0x07C0+((ch)*4))
#define SOLO_VE_CH_GOP(ch) (0x0800+((ch)*4))
......@@ -447,7 +448,7 @@
#define SOLO_VE_JPEG_QUE(n) (0x0A04+((n)*8))
#define SOLO_VD_CFG0 0x0900
#define SOLO6010_VD_CFG_NO_WRITE_NO_WINDOW (1<<24) /* 6010 only */
#define SOLO_VD_CFG_NO_WRITE_NO_WINDOW (1<<24)
#define SOLO_VD_CFG_BUSY_WIAT_CODE (1<<23)
#define SOLO_VD_CFG_BUSY_WIAT_REF (1<<22)
#define SOLO_VD_CFG_BUSY_WIAT_RES (1<<21)
......@@ -599,9 +600,9 @@
#define SOLO_UART_RX_DATA_POP (1<<8)
#define SOLO_TIMER_CLOCK_NUM 0x0be0
#define SOLO_TIMER_WATCHDOG 0x0be4
#define SOLO_TIMER_USEC 0x0be8
#define SOLO_TIMER_SEC 0x0bec
#define SOLO_TIMER_USEC_LSB 0x0d20 /* 6110 Only */
#define SOLO_AUDIO_CONTROL 0x0D00
#define SOLO_AUDIO_ENABLE (1<<31)
......@@ -629,9 +630,10 @@
#define SOLO_AUDIO_EVOL(ch, value) ((value)<<((ch)%10))
#define SOLO_AUDIO_STA 0x0D14
#define SOLO_WATCHDOG 0x0BE4
#define WATCHDOG_STAT(status) (status<<8)
#define WATCHDOG_TIME(sec) (sec&0xff)
/*
* Watchdog configuration
*/
#define SOLO_WATCHDOG 0x0be4
#define SOLO_WATCHDOG_SET(status, sec) (status << 8 | (sec & 0xff))
#endif /* __SOLO6X10_REGISTERS_H */
/*
* Copyright (C) 2010 Bluecherry, LLC www.bluecherrydvr.com
* Copyright (C) 2010 Ben Collins <bcollins@bluecherry.net>
* Copyright (C) 2010-2013 Bluecherry, LLC <http://www.bluecherrydvr.com>
*
* Original author:
* Ben Collins <bcollins@ubuntu.com>
*
* Additional work by:
* John Brooks <john.brooks@bluecherry.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -20,7 +25,7 @@
#ifndef __SOLO6X10_JPEG_H
#define __SOLO6X10_JPEG_H
static unsigned char jpeg_header[] = {
static const unsigned char jpeg_header[] = {
0xff, 0xd8, 0xff, 0xfe, 0x00, 0x0d, 0x42, 0x6c,
0x75, 0x65, 0x63, 0x68, 0x65, 0x72, 0x72, 0x79,
0x20, 0xff, 0xdb, 0x00, 0x43, 0x00, 0x20, 0x16,
......@@ -102,4 +107,87 @@ static unsigned char jpeg_header[] = {
/* This is the byte marker for the start of SOF0: 0xffc0 marker */
#define SOF0_START 575
/* This is the byte marker for the start of the DQT */
#define DQT_START 17
#define DQT_LEN 138
const unsigned char jpeg_dqt[4][DQT_LEN] = {
{
0xff, 0xdb, 0x00, 0x43, 0x00,
0x08, 0x06, 0x06, 0x07, 0x06, 0x05, 0x08, 0x07,
0x07, 0x07, 0x09, 0x09, 0x08, 0x0a, 0x0c, 0x14,
0x0d, 0x0c, 0x0b, 0x0b, 0x0c, 0x19, 0x12, 0x13,
0x0f, 0x14, 0x1d, 0x1a, 0x1f, 0x1e, 0x1d, 0x1a,
0x1c, 0x1c, 0x20, 0x24, 0x2e, 0x27, 0x20, 0x22,
0x2c, 0x23, 0x1c, 0x1c, 0x28, 0x37, 0x29, 0x2c,
0x30, 0x31, 0x34, 0x34, 0x34, 0x1f, 0x27, 0x39,
0x3d, 0x38, 0x32, 0x3c, 0x2e, 0x33, 0x34, 0x32,
0xff, 0xdb, 0x00, 0x43, 0x01,
0x09, 0x09, 0x09, 0x0c, 0x0b, 0x0c, 0x18, 0x0d,
0x0d, 0x18, 0x32, 0x21, 0x1c, 0x21, 0x32, 0x32,
0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32,
0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32,
0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32,
0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32,
0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32,
0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32
}, {
0xff, 0xdb, 0x00, 0x43, 0x00,
0x10, 0x0b, 0x0c, 0x0e, 0x0c, 0x0a, 0x10, 0x0e,
0x0d, 0x0e, 0x12, 0x11, 0x10, 0x13, 0x18, 0x28,
0x1a, 0x18, 0x16, 0x16, 0x18, 0x31, 0x23, 0x25,
0x1d, 0x28, 0x3a, 0x33, 0x3d, 0x3c, 0x39, 0x33,
0x38, 0x37, 0x40, 0x48, 0x5c, 0x4e, 0x40, 0x44,
0x57, 0x45, 0x37, 0x38, 0x50, 0x6d, 0x51, 0x57,
0x5f, 0x62, 0x67, 0x68, 0x67, 0x3e, 0x4d, 0x71,
0x79, 0x70, 0x64, 0x78, 0x5c, 0x65, 0x67, 0x63,
0xff, 0xdb, 0x00, 0x43, 0x01,
0x11, 0x12, 0x12, 0x18, 0x15, 0x18, 0x2f, 0x1a,
0x1a, 0x2f, 0x63, 0x42, 0x38, 0x42, 0x63, 0x63,
0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63,
0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63,
0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63,
0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63,
0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63,
0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63
}, {
0xff, 0xdb, 0x00, 0x43, 0x00,
0x20, 0x16, 0x18, 0x1c, 0x18, 0x14, 0x20, 0x1c,
0x1a, 0x1c, 0x24, 0x22, 0x20, 0x26, 0x30, 0x50,
0x34, 0x30, 0x2c, 0x2c, 0x30, 0x62, 0x46, 0x4a,
0x3a, 0x50, 0x74, 0x66, 0x7a, 0x78, 0x72, 0x66,
0x70, 0x6e, 0x80, 0x90, 0xb8, 0x9c, 0x80, 0x88,
0xae, 0x8a, 0x6e, 0x70, 0xa0, 0xda, 0xa2, 0xae,
0xbe, 0xc4, 0xce, 0xd0, 0xce, 0x7c, 0x9a, 0xe2,
0xf2, 0xe0, 0xc8, 0xf0, 0xb8, 0xca, 0xce, 0xc6,
0xff, 0xdb, 0x00, 0x43, 0x01,
0x22, 0x24, 0x24, 0x30, 0x2a, 0x30, 0x5e, 0x34,
0x34, 0x5e, 0xc6, 0x84, 0x70, 0x84, 0xc6, 0xc6,
0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6,
0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6,
0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6,
0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6,
0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6,
0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6
}, {
0xff, 0xdb, 0x00, 0x43, 0x00,
0x30, 0x21, 0x24, 0x2a, 0x24, 0x1e, 0x30, 0x2a,
0x27, 0x2a, 0x36, 0x33, 0x30, 0x39, 0x48, 0x78,
0x4e, 0x48, 0x42, 0x42, 0x48, 0x93, 0x69, 0x6f,
0x57, 0x78, 0xae, 0x99, 0xb7, 0xb4, 0xab, 0x99,
0xa8, 0xa5, 0xc0, 0xd8, 0xff, 0xea, 0xc0, 0xcc,
0xff, 0xcf, 0xa5, 0xa8, 0xf0, 0xff, 0xf3, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xba, 0xe7, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xdb, 0x00, 0x43, 0x01,
0x33, 0x36, 0x36, 0x48, 0x3f, 0x48, 0x8d, 0x4e,
0x4e, 0x8d, 0xff, 0xc6, 0xa8, 0xc6, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
}
};
#endif /* __SOLO6X10_JPEG_H */
This diff is collapsed.
This diff is collapsed.
/*
* Copyright (C) 2010 Bluecherry, LLC www.bluecherrydvr.com
* Copyright (C) 2010 Ben Collins <bcollins@bluecherry.net>
* Copyright (C) 2010-2013 Bluecherry, LLC <http://www.bluecherrydvr.com>
*
* Original author:
* Ben Collins <bcollins@ubuntu.com>
*
* Additional work by:
* John Brooks <john.brooks@bluecherry.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -36,7 +41,7 @@
#define TW_AUDIO_INPUT_GAIN_ADDR(n) (0x60 + ((n > 1) ? 1 : 0))
/* tw286x */
#define TW286X_AV_STAT_ADDR 0xfd
#define TW286x_AV_STAT_ADDR 0xfd
#define TW286x_HUE_ADDR(n) (0x06 | ((n) << 4))
#define TW286x_SATURATIONU_ADDR(n) (0x04 | ((n) << 4))
#define TW286x_SATURATIONV_ADDR(n) (0x05 | ((n) << 4))
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment