mxb
int mxb;
mxb = nc ? nc->max_buffers : 1000000; /* arbitrary limit on open requests */
return mxb;
int mxb = drbd_get_max_buffers(device);
if (atomic_read(&device->ap_bio_cnt) > mxb)
int mxb = drbd_get_max_buffers(device);
if (ap_bio < mxb)
unsigned int mxb;
mxb = nc ? nc->max_buffers : 1000000;
if (atomic_read(&device->pp_in_use) >= mxb)
int number, mxb;
mxb = drbd_get_max_buffers(device) / 2;
if (mxb - device->rs_in_flight/8 < number)
number = mxb - device->rs_in_flight/8;
#define saa7111a_call(mxb, o, f, args...) \
v4l2_subdev_call(mxb->saa7111a, o, f, ##args)
#define tda9840_call(mxb, o, f, args...) \
v4l2_subdev_call(mxb->tda9840, o, f, ##args)
#define tea6415c_call(mxb, o, f, args...) \
v4l2_subdev_call(mxb->tea6415c, o, f, ##args)
#define tuner_call(mxb, o, f, args...) \
v4l2_subdev_call(mxb->tuner, o, f, ##args)
static void mxb_update_audmode(struct mxb *mxb)
.audmode = mxb->cur_mode,
tda9840_call(mxb, tuner, s_tuner, &t);
static inline void tea6420_route(struct mxb *mxb, int idx)
v4l2_subdev_call(mxb->tea6420_1, audio, s_routing,
v4l2_subdev_call(mxb->tea6420_2, audio, s_routing,
v4l2_subdev_call(mxb->tea6420_1, audio, s_routing,
v4l2_subdev_call(mxb->tea6420_2, audio, s_routing,
struct mxb *mxb = dev->ext_priv;
mxb->cur_mute = ctrl->val;
tea6420_route(mxb, ctrl->val ? 6 :
video_audio_connect[mxb->cur_input]);
struct mxb *mxb = NULL;
mxb = kzalloc_obj(struct mxb);
if (mxb == NULL) {
snprintf(mxb->i2c_adapter.name, sizeof(mxb->i2c_adapter.name), "mxb%d", mxb_num);
saa7146_i2c_adapter_prepare(dev, &mxb->i2c_adapter, SAA7146_I2C_BUS_BIT_RATE_480);
if (i2c_add_adapter(&mxb->i2c_adapter) < 0) {
kfree(mxb);
mxb->saa7111a = v4l2_i2c_new_subdev(&dev->v4l2_dev, &mxb->i2c_adapter,
mxb->tea6420_1 = v4l2_i2c_new_subdev(&dev->v4l2_dev, &mxb->i2c_adapter,
mxb->tea6420_2 = v4l2_i2c_new_subdev(&dev->v4l2_dev, &mxb->i2c_adapter,
mxb->tea6415c = v4l2_i2c_new_subdev(&dev->v4l2_dev, &mxb->i2c_adapter,
mxb->tda9840 = v4l2_i2c_new_subdev(&dev->v4l2_dev, &mxb->i2c_adapter,
mxb->tuner = v4l2_i2c_new_subdev(&dev->v4l2_dev, &mxb->i2c_adapter,
if (!mxb->tea6420_1 || !mxb->tea6420_2 || !mxb->tea6415c ||
!mxb->tda9840 || !mxb->saa7111a || !mxb->tuner) {
i2c_del_adapter(&mxb->i2c_adapter);
kfree(mxb);
dev->ext_priv = mxb;
struct mxb* mxb = (struct mxb*)dev->ext_priv;
tea6420_route(mxb, 6);
saa7111a_call(mxb, video, s_std, std);
saa7111a_call(mxb, video, s_routing, SAA7115_COMPOSITE0,
tuner_call(mxb, tuner, s_type_addr, &tun_setup);
mxb->cur_freq.tuner = 0;
mxb->cur_freq.type = V4L2_TUNER_ANALOG_TV;
mxb->cur_freq.frequency = freq;
tuner_call(mxb, tuner, s_frequency, &mxb->cur_freq);
saa7111a_call(mxb, core, s_gpio, 1);
saa7111a_call(mxb, video, s_std, std);
tuner_call(mxb, video, s_std, std);
tea6415c_call(mxb, video, s_routing, 3, 17, 0);
tea6415c_call(mxb, video, s_routing, 3, 13, 0);
mxb->cur_input = 0;
mxb->cur_audinput = video_audio_connect[mxb->cur_input];
mxb->cur_mute = 1;
mxb->cur_mode = V4L2_TUNER_MODE_STEREO;
mxb_update_audmode(mxb);
err = i2c_transfer(&mxb->i2c_adapter, &msg, 1);
err = i2c_transfer(&mxb->i2c_adapter, &msg, 1);
saa7146_set_hps_source_and_sync(dev, input_port_selection[mxb->cur_input].hps_source,
input_port_selection[mxb->cur_input].hps_sync);
struct mxb *mxb = (struct mxb *)dev->ext_priv;
*i = mxb->cur_input;
struct mxb *mxb = (struct mxb *)dev->ext_priv;
mxb->cur_input = input;
err = tea6415c_call(mxb, video, s_routing, 3, 17, 0);
err = tea6415c_call(mxb, video, s_routing, 3, 13, 0);
err = tea6415c_call(mxb, video, s_routing, 1, 17, 0);
mxb->video_dev.tvnorms = mxb_inputs[input].std;
mxb->vbi_dev.tvnorms = mxb_inputs[input].std;
if (saa7111a_call(mxb, video, s_routing, i, SAA7111_FMT_CCIR, 0))
mxb->cur_audinput = video_audio_connect[input];
if (0 == mxb->cur_mute)
tea6420_route(mxb, mxb->cur_audinput);
if (mxb->cur_audinput == 0)
mxb_update_audmode(mxb);
struct mxb *mxb = (struct mxb *)dev->ext_priv;
t->audmode = mxb->cur_mode;
struct mxb *mxb = (struct mxb *)dev->ext_priv;
mxb->cur_mode = t->audmode;
struct mxb *mxb = (struct mxb *)dev->ext_priv;
*f = mxb->cur_freq;
DEB_EE("VIDIOC_G_FREQ: freq:0x%08x\n", mxb->cur_freq.frequency);
struct mxb *mxb = (struct mxb *)dev->ext_priv;
DEB_EE("VIDIOC_S_FREQUENCY: freq:0x%08x\n", mxb->cur_freq.frequency);
tuner_call(mxb, tuner, s_frequency, f);
mxb->cur_freq = *f;
tuner_call(mxb, tuner, g_frequency, &mxb->cur_freq);
if (mxb->cur_audinput == 0)
mxb_update_audmode(mxb);
struct mxb *mxb = (struct mxb *)dev->ext_priv;
*a = mxb_audios[mxb->cur_audinput];
struct mxb *mxb = (struct mxb *)dev->ext_priv;
!(mxb_inputs[mxb->cur_input].audioset & (1 << a->index)))
if (mxb->cur_audinput != a->index) {
mxb->cur_audinput = a->index;
tea6420_route(mxb, a->index);
if (mxb->cur_audinput == 0)
mxb_update_audmode(mxb);
struct mxb *mxb;
mxb = (struct mxb *)dev->ext_priv;
if (saa7146_register_device(&mxb->video_dev, dev, "mxb", VFL_TYPE_VIDEO)) {
if (saa7146_register_device(&mxb->vbi_dev, dev, "mxb", VFL_TYPE_VBI)) {
struct mxb *mxb = (struct mxb *)dev->ext_priv;
tea6420_route(mxb, 6);
saa7146_unregister_device(&mxb->video_dev,dev);
saa7146_unregister_device(&mxb->vbi_dev, dev);
i2c_del_adapter(&mxb->i2c_adapter);
kfree(mxb);
struct mxb *mxb = (struct mxb *)dev->ext_priv;
saa7111a_call(mxb, core, s_gpio, 0);
saa7111a_call(mxb, video, s_std, std);
if (mxb->cur_input == 0)
tuner_call(mxb, video, s_std, std);
if (mxb->cur_input)
saa7111a_call(mxb, core, s_gpio, 1);
saa7111a_call(mxb, video, s_std, std);
if (mxb->cur_input == 0)
tuner_call(mxb, video, s_std, std);
static struct saa7146_pci_extension_data mxb = {
.driver_data = (unsigned long)&mxb,