brintos

brintos / linux-shallow public Read only

0
0
Text · 3.6 KiB · 7d39171 Raw
150 lines · c
1/* SPDX-License-Identifier: GPL-2.0 */2/*3 */4 5#ifndef MSP3400_DRIVER_H6#define MSP3400_DRIVER_H7 8#include <media/drv-intf/msp3400.h>9#include <media/v4l2-device.h>10#include <media/v4l2-ctrls.h>11#include <media/v4l2-mc.h>12 13/* ---------------------------------------------------------------------- */14 15/* This macro is allowed for *constants* only, gcc must calculate it16   at compile time.  Remember -- no floats in kernel mode */17#define MSP_CARRIER(freq) ((int)((float)(freq / 18.432) * (1 << 24)))18 19#define MSP_MODE_AM_DETECT   020#define MSP_MODE_FM_RADIO    221#define MSP_MODE_FM_TERRA    322#define MSP_MODE_FM_SAT      423#define MSP_MODE_FM_NICAM1   524#define MSP_MODE_FM_NICAM2   625#define MSP_MODE_AM_NICAM    726#define MSP_MODE_BTSC        827#define MSP_MODE_EXTERN      928 29#define SCART_IN1     030#define SCART_IN2     131#define SCART_IN3     232#define SCART_IN4     333#define SCART_IN1_DA  434#define SCART_IN2_DA  535#define SCART_MONO    636#define SCART_MUTE    737 38#define SCART_DSP_IN  039#define SCART1_OUT    140#define SCART2_OUT    241 42#define OPMODE_AUTO       -143#define OPMODE_MANUAL      044#define OPMODE_AUTODETECT  1   /* use autodetect (>= msp3410 only) */45#define OPMODE_AUTOSELECT  2   /* use autodetect & autoselect (>= msp34xxG)   */46 47/* module parameters */48extern int msp_debug;49extern bool msp_once;50extern bool msp_amsound;51extern int msp_standard;52extern bool msp_dolby;53extern int msp_stereo_thresh;54 55enum msp3400_pads {56	MSP3400_PAD_IF_INPUT,57	MSP3400_PAD_OUT,58	MSP3400_NUM_PADS59};60 61struct msp_state {62	struct v4l2_subdev sd;63	struct v4l2_ctrl_handler hdl;64	int rev1, rev2;65	int ident;66	u8 has_nicam;67	u8 has_radio;68	u8 has_headphones;69	u8 has_ntsc_jp_d_k3;70	u8 has_scart2;71	u8 has_scart3;72	u8 has_scart4;73	u8 has_scart2_out;74	u8 has_scart2_out_volume;75	u8 has_i2s_conf;76	u8 has_subwoofer;77	u8 has_sound_processing;78	u8 has_virtual_dolby_surround;79	u8 has_dolby_pro_logic;80	u8 force_btsc;81 82	int radio;83	int opmode;84	int std;85	int mode;86	v4l2_std_id v4l2_std, detected_std;87	int nicam_on;88	int acb;89	int in_scart;90	int i2s_mode;91	int main, second;	/* sound carrier */92	int input;93	u32 route_in;94	u32 route_out;95 96	/* v4l2 */97	int audmode;98	int rxsubchans;99 100	struct {101		/* volume cluster */102		struct v4l2_ctrl *volume;103		struct v4l2_ctrl *muted;104	};105 106	int scan_in_progress;107 108	/* thread */109	struct task_struct   *kthread;110	wait_queue_head_t    wq;111	unsigned int         restart:1;112	unsigned int         watch_stereo:1;113 114#if IS_ENABLED(CONFIG_MEDIA_CONTROLLER)115	struct media_pad pads[MSP3400_NUM_PADS];116#endif117};118 119static inline struct msp_state *to_state(struct v4l2_subdev *sd)120{121	return container_of(sd, struct msp_state, sd);122}123 124static inline struct msp_state *ctrl_to_state(struct v4l2_ctrl *ctrl)125{126	return container_of(ctrl->handler, struct msp_state, hdl);127}128 129/* msp3400-driver.c */130int msp_write_dem(struct i2c_client *client, int addr, int val);131int msp_write_dsp(struct i2c_client *client, int addr, int val);132int msp_read_dem(struct i2c_client *client, int addr);133int msp_read_dsp(struct i2c_client *client, int addr);134int msp_reset(struct i2c_client *client);135void msp_set_scart(struct i2c_client *client, int in, int out);136void msp_update_volume(struct msp_state *state);137int msp_sleep(struct msp_state *state, int msec);138 139/* msp3400-kthreads.c */140const char *msp_standard_std_name(int std);141void msp_set_audmode(struct i2c_client *client);142int msp_detect_stereo(struct i2c_client *client);143int msp3400c_thread(void *data);144int msp3410d_thread(void *data);145int msp34xxg_thread(void *data);146void msp3400c_set_mode(struct i2c_client *client, int mode);147void msp3400c_set_carrier(struct i2c_client *client, int cdo1, int cdo2);148 149#endif /* MSP3400_DRIVER_H */150