int ivtv_start_v4l2_decode_stream(struct ivtv_stream *s, int gop_offset) { struct ivtv *itv = s->itv; if (s->v4l2dev == NULL) return -EINVAL; if (test_and_set_bit(IVTV_F_S_STREAMING, &s->s_flags)) return 0; /* already started */ IVTV_DEBUG_INFO("Starting decode stream %s (gop_offset %d)\n", s->name, gop_offset); /* Clear Streamoff */ if (s->type == IVTV_DEC_STREAM_TYPE_YUV) { /* Initialize Decoder */ /* Reprogram Decoder YUV Buffers for YUV */ write_reg(yuv_offset[0] >> 4, 0x82c); write_reg((yuv_offset[0] + IVTV_YUV_BUFFER_UV_OFFSET) >> 4, 0x830); write_reg(yuv_offset[0] >> 4, 0x834); write_reg((yuv_offset[0] + IVTV_YUV_BUFFER_UV_OFFSET) >> 4, 0x838); write_reg_sync(0x00000000 | (0x0c << 16) | (0x0b << 8), 0x2d24); write_reg_sync(0x00108080, 0x2898); /* Enable YUV decoder output */ write_reg_sync(0x01, IVTV_REG_VDM); }
static void cx18_setsda(void *data, int state) { struct cx18 *cx = ((struct cx18_i2c_algo_callback_data *)data)->cx; int bus_index = ((struct cx18_i2c_algo_callback_data *)data)->bus_index; u32 addr = bus_index ? CX18_REG_I2C_2_WR : CX18_REG_I2C_1_WR; u32 r = read_reg(addr); if (state) write_reg_sync(r | SETSDL_BIT, addr); else write_reg_sync(r & ~SETSDL_BIT, addr); }
/* init + register i2c algo-bit adapter */ int init_cx18_i2c(struct cx18 *cx) { int i; CX18_DEBUG_I2C("i2c init\n"); for (i = 0; i < 2; i++) { memcpy(&cx->i2c_adap[i], &cx18_i2c_adap_template, sizeof(struct i2c_adapter)); memcpy(&cx->i2c_algo[i], &cx18_i2c_algo_template, sizeof(struct i2c_algo_bit_data)); cx->i2c_algo_cb_data[i].cx = cx; cx->i2c_algo_cb_data[i].bus_index = i; cx->i2c_algo[i].data = &cx->i2c_algo_cb_data[i]; cx->i2c_adap[i].algo_data = &cx->i2c_algo[i]; sprintf(cx->i2c_adap[i].name + strlen(cx->i2c_adap[i].name), " #%d-%d", cx->num, i); i2c_set_adapdata(&cx->i2c_adap[i], cx); memcpy(&cx->i2c_client[i], &cx18_i2c_client_template, sizeof(struct i2c_client)); sprintf(cx->i2c_client[i].name + strlen(cx->i2c_client[i].name), "%d", i); cx->i2c_client[i].adapter = &cx->i2c_adap[i]; cx->i2c_adap[i].dev.parent = &cx->dev->dev; } if (read_reg(CX18_REG_I2C_2_WR) != 0x0003c02f) { /* Reset/Unreset I2C hardware block */ write_reg(0x10000000, 0xc71004); /* Clock select 220MHz */ write_reg_sync(0x10001000, 0xc71024); /* Clock Enable */ } /* courtesy of Steven Toth <*****@*****.**> */ write_reg_sync(0x00c00000, 0xc7001c); mdelay(10); write_reg_sync(0x00c000c0, 0xc7001c); mdelay(10); write_reg_sync(0x00c00000, 0xc7001c); write_reg_sync(0x00c00000, 0xc730c8); /* Set to edge-triggered intrs. */ write_reg_sync(0x00c00000, 0xc730c4); /* Clear any stale intrs */ /* Hw I2C1 Clock Freq ~100kHz */ write_reg_sync(0x00021c0f & ~4, CX18_REG_I2C_1_WR); cx18_setscl(&cx->i2c_algo_cb_data[0], 1); cx18_setsda(&cx->i2c_algo_cb_data[0], 1); /* Hw I2C2 Clock Freq ~100kHz */ write_reg_sync(0x00021c0f & ~4, CX18_REG_I2C_2_WR); cx18_setscl(&cx->i2c_algo_cb_data[1], 1); cx18_setsda(&cx->i2c_algo_cb_data[1], 1); cx18_reset_i2c_slaves_gpio(cx); return i2c_bit_add_bus(&cx->i2c_adap[0]) || i2c_bit_add_bus(&cx->i2c_adap[1]); }
void ivtv_udma_start(struct ivtv *itv) { IVTV_DEBUG_DMA("start UDMA\n"); write_reg(itv->udma.SG_handle, IVTV_REG_DECDMAADDR); write_reg_sync(read_reg(IVTV_REG_DMAXFER) | 0x01, IVTV_REG_DMAXFER); set_bit(IVTV_F_I_DMA, &itv->i_flags); set_bit(IVTV_F_I_UDMA, &itv->i_flags); }
void ivtv_set_irq_mask(struct ivtv *itv, u32 mask) { itv->irqmask |= mask; write_reg_sync(itv->irqmask, IVTV_REG_IRQMASK); }
void ivtv_clear_irq_mask(struct ivtv *itv, u32 mask) { itv->irqmask &= ~mask; write_reg_sync(itv->irqmask, IVTV_REG_IRQMASK); }