2006-06-27 07:58:46 +08:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Copyright (C) 2005 Mike Isely <isely@pobox.com>
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2006-09-29 01:03:26 +08:00
|
|
|
#include <linux/kernel.h>
|
2006-06-27 07:58:46 +08:00
|
|
|
#include "pvrusb2-i2c-core.h"
|
|
|
|
#include "pvrusb2-hdw-internal.h"
|
|
|
|
#include "pvrusb2-debug.h"
|
|
|
|
#include "pvrusb2-i2c-cmd-v4l2.h"
|
|
|
|
#include "pvrusb2-audio.h"
|
|
|
|
#include "pvrusb2-tuner.h"
|
|
|
|
#include "pvrusb2-video-v4l.h"
|
|
|
|
#include "pvrusb2-cx2584x-v4l.h"
|
|
|
|
#include "pvrusb2-wm8775.h"
|
|
|
|
|
|
|
|
#define trace_i2c(...) pvr2_trace(PVR2_TRACE_I2C,__VA_ARGS__)
|
|
|
|
|
2009-01-16 14:06:02 +08:00
|
|
|
#define OP_INIT 0 /* MUST come first so it is run first */
|
|
|
|
#define OP_STANDARD 1
|
|
|
|
#define OP_AUDIOMODE 2
|
|
|
|
#define OP_BCSH 3
|
|
|
|
#define OP_VOLUME 4
|
|
|
|
#define OP_FREQ 5
|
|
|
|
#define OP_AUDIORATE 6
|
|
|
|
#define OP_CROP 7
|
|
|
|
#define OP_SIZE 8
|
|
|
|
#define OP_LOG 9
|
2006-06-27 07:58:46 +08:00
|
|
|
|
|
|
|
static const struct pvr2_i2c_op * const ops[] = {
|
2009-01-16 14:06:02 +08:00
|
|
|
[OP_INIT] = &pvr2_i2c_op_v4l2_init,
|
2006-06-27 07:58:46 +08:00
|
|
|
[OP_STANDARD] = &pvr2_i2c_op_v4l2_standard,
|
2007-01-20 12:56:04 +08:00
|
|
|
[OP_AUDIOMODE] = &pvr2_i2c_op_v4l2_audiomode,
|
2006-06-27 07:58:46 +08:00
|
|
|
[OP_BCSH] = &pvr2_i2c_op_v4l2_bcsh,
|
|
|
|
[OP_VOLUME] = &pvr2_i2c_op_v4l2_volume,
|
|
|
|
[OP_FREQ] = &pvr2_i2c_op_v4l2_frequency,
|
2008-08-31 05:26:39 +08:00
|
|
|
[OP_CROP] = &pvr2_i2c_op_v4l2_crop,
|
2006-06-27 07:58:46 +08:00
|
|
|
[OP_SIZE] = &pvr2_i2c_op_v4l2_size,
|
|
|
|
[OP_LOG] = &pvr2_i2c_op_v4l2_log,
|
|
|
|
};
|
|
|
|
|
|
|
|
void pvr2_i2c_probe(struct pvr2_hdw *hdw,struct pvr2_i2c_client *cp)
|
|
|
|
{
|
|
|
|
int id;
|
|
|
|
id = cp->client->driver->id;
|
2009-01-16 14:06:02 +08:00
|
|
|
cp->ctl_mask = ((1 << OP_INIT) |
|
|
|
|
(1 << OP_STANDARD) |
|
2007-01-20 12:56:04 +08:00
|
|
|
(1 << OP_AUDIOMODE) |
|
2006-06-27 07:58:46 +08:00
|
|
|
(1 << OP_BCSH) |
|
|
|
|
(1 << OP_VOLUME) |
|
|
|
|
(1 << OP_FREQ) |
|
2008-08-31 05:26:39 +08:00
|
|
|
(1 << OP_CROP) |
|
2006-06-27 07:58:46 +08:00
|
|
|
(1 << OP_SIZE) |
|
2006-12-28 10:14:54 +08:00
|
|
|
(1 << OP_LOG));
|
2007-01-20 11:09:47 +08:00
|
|
|
cp->status_poll = pvr2_v4l2_cmd_status_poll;
|
2006-06-27 07:58:46 +08:00
|
|
|
|
|
|
|
if (id == I2C_DRIVERID_MSP3400) {
|
|
|
|
if (pvr2_i2c_msp3400_setup(hdw,cp)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (id == I2C_DRIVERID_TUNER) {
|
|
|
|
if (pvr2_i2c_tuner_setup(hdw,cp)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (id == I2C_DRIVERID_CX25840) {
|
|
|
|
if (pvr2_i2c_cx2584x_v4l_setup(hdw,cp)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (id == I2C_DRIVERID_WM8775) {
|
|
|
|
if (pvr2_i2c_wm8775_setup(hdw,cp)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (id == I2C_DRIVERID_SAA711X) {
|
|
|
|
if (pvr2_i2c_decoder_v4l_setup(hdw,cp)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const struct pvr2_i2c_op *pvr2_i2c_get_op(unsigned int idx)
|
|
|
|
{
|
2006-09-29 01:03:26 +08:00
|
|
|
if (idx >= ARRAY_SIZE(ops))
|
|
|
|
return NULL;
|
2006-06-27 07:58:46 +08:00
|
|
|
return ops[idx];
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
Stuff for Emacs to see, in order to encourage consistent editing style:
|
|
|
|
*** Local Variables: ***
|
|
|
|
*** mode: c ***
|
|
|
|
*** fill-column: 75 ***
|
|
|
|
*** tab-width: 8 ***
|
|
|
|
*** c-basic-offset: 8 ***
|
|
|
|
*** End: ***
|
|
|
|
*/
|