2005-06-23 22:05:07 -07:00
|
|
|
/*
|
|
|
|
*/
|
|
|
|
|
2006-03-19 04:45:38 -07:00
|
|
|
#ifndef MSP3400_DRIVER_H
|
|
|
|
#define MSP3400_DRIVER_H
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2015-11-13 14:40:07 -07:00
|
|
|
#include <media/drv-intf/msp3400.h>
|
2008-11-24 14:16:46 -07:00
|
|
|
#include <media/v4l2-device.h>
|
2010-05-24 06:01:58 -07:00
|
|
|
#include <media/v4l2-ctrls.h>
|
2016-01-28 03:51:01 -07:00
|
|
|
#include <media/v4l2-mc.h>
|
2006-03-19 08:35:57 -07:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
/* ---------------------------------------------------------------------- */
|
|
|
|
|
2006-01-09 10:32:39 -07:00
|
|
|
/* This macro is allowed for *constants* only, gcc must calculate it
|
|
|
|
at compile time. Remember -- no floats in kernel mode */
|
|
|
|
#define MSP_CARRIER(freq) ((int)((float)(freq / 18.432) * (1 << 24)))
|
|
|
|
|
|
|
|
#define MSP_MODE_AM_DETECT 0
|
|
|
|
#define MSP_MODE_FM_RADIO 2
|
|
|
|
#define MSP_MODE_FM_TERRA 3
|
|
|
|
#define MSP_MODE_FM_SAT 4
|
|
|
|
#define MSP_MODE_FM_NICAM1 5
|
|
|
|
#define MSP_MODE_FM_NICAM2 6
|
|
|
|
#define MSP_MODE_AM_NICAM 7
|
|
|
|
#define MSP_MODE_BTSC 8
|
|
|
|
#define MSP_MODE_EXTERN 9
|
|
|
|
|
2006-03-19 02:48:51 -07:00
|
|
|
#define SCART_IN1 0
|
|
|
|
#define SCART_IN2 1
|
|
|
|
#define SCART_IN3 2
|
|
|
|
#define SCART_IN4 3
|
|
|
|
#define SCART_IN1_DA 4
|
|
|
|
#define SCART_IN2_DA 5
|
|
|
|
#define SCART_MONO 6
|
|
|
|
#define SCART_MUTE 7
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
#define SCART_DSP_IN 0
|
|
|
|
#define SCART1_OUT 1
|
|
|
|
#define SCART2_OUT 2
|
|
|
|
|
2006-01-09 10:32:39 -07:00
|
|
|
#define OPMODE_AUTO -1
|
|
|
|
#define OPMODE_MANUAL 0
|
|
|
|
#define OPMODE_AUTODETECT 1 /* use autodetect (>= msp3410 only) */
|
|
|
|
#define OPMODE_AUTOSELECT 2 /* use autodetect & autoselect (>= msp34xxG) */
|
|
|
|
|
|
|
|
/* module parameters */
|
2006-01-11 14:41:49 -07:00
|
|
|
extern int msp_debug;
|
2012-01-12 16:02:20 -07:00
|
|
|
extern bool msp_once;
|
|
|
|
extern bool msp_amsound;
|
2006-01-11 14:41:49 -07:00
|
|
|
extern int msp_standard;
|
2012-01-12 16:02:20 -07:00
|
|
|
extern bool msp_dolby;
|
2006-01-11 14:41:49 -07:00
|
|
|
extern int msp_stereo_thresh;
|
2006-01-09 10:32:39 -07:00
|
|
|
|
|
|
|
struct msp_state {
|
2008-11-24 14:16:46 -07:00
|
|
|
struct v4l2_subdev sd;
|
2010-05-24 06:01:58 -07:00
|
|
|
struct v4l2_ctrl_handler hdl;
|
2006-01-09 10:32:39 -07:00
|
|
|
int rev1, rev2;
|
2007-04-27 08:31:26 -07:00
|
|
|
int ident;
|
2006-01-09 13:21:37 -07:00
|
|
|
u8 has_nicam;
|
|
|
|
u8 has_radio;
|
|
|
|
u8 has_headphones;
|
|
|
|
u8 has_ntsc_jp_d_k3;
|
2006-03-30 15:50:34 -07:00
|
|
|
u8 has_scart2;
|
|
|
|
u8 has_scart3;
|
2006-01-09 13:21:37 -07:00
|
|
|
u8 has_scart4;
|
2006-03-30 15:50:34 -07:00
|
|
|
u8 has_scart2_out;
|
2006-01-09 13:21:37 -07:00
|
|
|
u8 has_scart2_out_volume;
|
|
|
|
u8 has_i2s_conf;
|
|
|
|
u8 has_subwoofer;
|
|
|
|
u8 has_sound_processing;
|
|
|
|
u8 has_virtual_dolby_surround;
|
|
|
|
u8 has_dolby_pro_logic;
|
2006-10-01 13:56:32 -07:00
|
|
|
u8 force_btsc;
|
2006-01-09 13:21:32 -07:00
|
|
|
|
|
|
|
int radio;
|
2006-01-09 10:32:39 -07:00
|
|
|
int opmode;
|
2006-01-09 13:21:37 -07:00
|
|
|
int std;
|
2006-01-09 10:32:39 -07:00
|
|
|
int mode;
|
2011-10-04 05:44:02 -07:00
|
|
|
v4l2_std_id v4l2_std, detected_std;
|
2006-01-09 10:32:39 -07:00
|
|
|
int nicam_on;
|
|
|
|
int acb;
|
|
|
|
int in_scart;
|
|
|
|
int i2s_mode;
|
|
|
|
int main, second; /* sound carrier */
|
|
|
|
int input;
|
2009-04-02 07:26:22 -07:00
|
|
|
u32 route_in;
|
|
|
|
u32 route_out;
|
2006-01-09 10:32:39 -07:00
|
|
|
|
|
|
|
/* v4l2 */
|
|
|
|
int audmode;
|
|
|
|
int rxsubchans;
|
|
|
|
|
2010-05-24 06:01:58 -07:00
|
|
|
struct {
|
|
|
|
/* volume cluster */
|
|
|
|
struct v4l2_ctrl *volume;
|
|
|
|
struct v4l2_ctrl *muted;
|
|
|
|
};
|
|
|
|
|
2006-04-01 11:27:52 -07:00
|
|
|
int scan_in_progress;
|
2006-01-09 10:32:39 -07:00
|
|
|
|
|
|
|
/* thread */
|
|
|
|
struct task_struct *kthread;
|
|
|
|
wait_queue_head_t wq;
|
2006-06-28 11:05:11 -07:00
|
|
|
unsigned int restart:1;
|
|
|
|
unsigned int watch_stereo:1;
|
2016-01-28 03:51:01 -07:00
|
|
|
|
2016-02-02 08:47:58 -07:00
|
|
|
#if IS_ENABLED(CONFIG_MEDIA_CONTROLLER)
|
2016-01-28 03:51:01 -07:00
|
|
|
struct media_pad pads[IF_AUD_DEC_PAD_NUM_PADS];
|
|
|
|
#endif
|
2006-01-09 10:32:39 -07:00
|
|
|
};
|
|
|
|
|
2008-11-24 14:16:46 -07:00
|
|
|
static inline struct msp_state *to_state(struct v4l2_subdev *sd)
|
|
|
|
{
|
|
|
|
return container_of(sd, struct msp_state, sd);
|
|
|
|
}
|
|
|
|
|
2010-05-24 06:01:58 -07:00
|
|
|
static inline struct msp_state *ctrl_to_state(struct v4l2_ctrl *ctrl)
|
|
|
|
{
|
|
|
|
return container_of(ctrl->handler, struct msp_state, hdl);
|
|
|
|
}
|
|
|
|
|
2006-01-09 10:32:39 -07:00
|
|
|
/* msp3400-driver.c */
|
|
|
|
int msp_write_dem(struct i2c_client *client, int addr, int val);
|
|
|
|
int msp_write_dsp(struct i2c_client *client, int addr, int val);
|
|
|
|
int msp_read_dem(struct i2c_client *client, int addr);
|
|
|
|
int msp_read_dsp(struct i2c_client *client, int addr);
|
|
|
|
int msp_reset(struct i2c_client *client);
|
|
|
|
void msp_set_scart(struct i2c_client *client, int in, int out);
|
2010-05-24 06:01:58 -07:00
|
|
|
void msp_update_volume(struct msp_state *state);
|
2006-01-09 10:32:39 -07:00
|
|
|
int msp_sleep(struct msp_state *state, int timeout);
|
|
|
|
|
|
|
|
/* msp3400-kthreads.c */
|
2006-01-09 13:21:37 -07:00
|
|
|
const char *msp_standard_std_name(int std);
|
2006-01-23 12:11:09 -07:00
|
|
|
void msp_set_audmode(struct i2c_client *client);
|
2006-03-19 04:21:56 -07:00
|
|
|
int msp_detect_stereo(struct i2c_client *client);
|
2006-01-09 10:32:39 -07:00
|
|
|
int msp3400c_thread(void *data);
|
|
|
|
int msp3410d_thread(void *data);
|
|
|
|
int msp34xxg_thread(void *data);
|
2006-01-23 12:11:09 -07:00
|
|
|
void msp3400c_set_mode(struct i2c_client *client, int mode);
|
|
|
|
void msp3400c_set_carrier(struct i2c_client *client, int cdo1, int cdo2);
|
2006-01-09 10:32:39 -07:00
|
|
|
|
2006-03-19 04:45:38 -07:00
|
|
|
#endif /* MSP3400_DRIVER_H */
|