Path: blob/master/drivers/media/video/cx25840/cx25840-core.h
17705 views
/* cx25840 internal API header1*2* Copyright (C) 2003-2004 Chris Kennedy3*4* This program is free software; you can redistribute it and/or5* modify it under the terms of the GNU General Public License6* as published by the Free Software Foundation; either version 27* of the License, or (at your option) any later version.8*9* This program is distributed in the hope that it will be useful,10* but WITHOUT ANY WARRANTY; without even the implied warranty of11* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12* GNU General Public License for more details.13*14* You should have received a copy of the GNU General Public License15* along with this program; if not, write to the Free Software16* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.17*/1819#ifndef _CX25840_CORE_H_20#define _CX25840_CORE_H_212223#include <linux/videodev2.h>24#include <media/v4l2-device.h>25#include <media/v4l2-chip-ident.h>26#include <media/v4l2-ctrls.h>27#include <linux/i2c.h>2829struct cx25840_ir_state;3031struct cx25840_state {32struct i2c_client *c;33struct v4l2_subdev sd;34struct v4l2_ctrl_handler hdl;35struct {36/* volume cluster */37struct v4l2_ctrl *volume;38struct v4l2_ctrl *mute;39};40int pvr150_workaround;41int radio;42v4l2_std_id std;43enum cx25840_video_input vid_input;44enum cx25840_audio_input aud_input;45u32 audclk_freq;46int audmode;47int vbi_line_offset;48u32 id;49u32 rev;50int is_initialized;51wait_queue_head_t fw_wait; /* wake up when the fw load is finished */52struct work_struct fw_work; /* work entry for fw load */53struct cx25840_ir_state *ir_state;54};5556static inline struct cx25840_state *to_state(struct v4l2_subdev *sd)57{58return container_of(sd, struct cx25840_state, sd);59}6061static inline struct v4l2_subdev *to_sd(struct v4l2_ctrl *ctrl)62{63return &container_of(ctrl->handler, struct cx25840_state, hdl)->sd;64}6566static inline bool is_cx2583x(struct cx25840_state *state)67{68return state->id == V4L2_IDENT_CX25836 ||69state->id == V4L2_IDENT_CX25837;70}7172static inline bool is_cx231xx(struct cx25840_state *state)73{74return state->id == V4L2_IDENT_CX2310X_AV;75}7677static inline bool is_cx2388x(struct cx25840_state *state)78{79return state->id == V4L2_IDENT_CX23885_AV ||80state->id == V4L2_IDENT_CX23887_AV ||81state->id == V4L2_IDENT_CX23888_AV;82}8384static inline bool is_cx23885(struct cx25840_state *state)85{86return state->id == V4L2_IDENT_CX23885_AV;87}8889static inline bool is_cx23887(struct cx25840_state *state)90{91return state->id == V4L2_IDENT_CX23887_AV;92}9394static inline bool is_cx23888(struct cx25840_state *state)95{96return state->id == V4L2_IDENT_CX23888_AV;97}9899/* ----------------------------------------------------------------------- */100/* cx25850-core.c */101int cx25840_write(struct i2c_client *client, u16 addr, u8 value);102int cx25840_write4(struct i2c_client *client, u16 addr, u32 value);103u8 cx25840_read(struct i2c_client *client, u16 addr);104u32 cx25840_read4(struct i2c_client *client, u16 addr);105int cx25840_and_or(struct i2c_client *client, u16 addr, unsigned mask, u8 value);106int cx25840_and_or4(struct i2c_client *client, u16 addr, u32 and_mask,107u32 or_value);108void cx25840_std_setup(struct i2c_client *client);109110/* ----------------------------------------------------------------------- */111/* cx25850-firmware.c */112int cx25840_loadfw(struct i2c_client *client);113114/* ----------------------------------------------------------------------- */115/* cx25850-audio.c */116void cx25840_audio_set_path(struct i2c_client *client);117int cx25840_s_clock_freq(struct v4l2_subdev *sd, u32 freq);118119extern const struct v4l2_ctrl_ops cx25840_audio_ctrl_ops;120121/* ----------------------------------------------------------------------- */122/* cx25850-vbi.c */123int cx25840_s_raw_fmt(struct v4l2_subdev *sd, struct v4l2_vbi_format *fmt);124int cx25840_s_sliced_fmt(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format *fmt);125int cx25840_g_sliced_fmt(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format *fmt);126int cx25840_decode_vbi_line(struct v4l2_subdev *sd, struct v4l2_decode_vbi_line *vbi);127128/* ----------------------------------------------------------------------- */129/* cx25850-ir.c */130extern const struct v4l2_subdev_ir_ops cx25840_ir_ops;131int cx25840_ir_log_status(struct v4l2_subdev *sd);132int cx25840_ir_irq_handler(struct v4l2_subdev *sd, u32 status, bool *handled);133int cx25840_ir_probe(struct v4l2_subdev *sd);134int cx25840_ir_remove(struct v4l2_subdev *sd);135136#endif137138139