#include <linux/module.h>
#include <linux/uaccess.h>
#include <linux/videodev2.h>
#include <media/v4l2-device.h>
#include <media/v4l2-ctrls.h>
MODULE_DESCRIPTION("i2c device driver for cs53l32a Audio ADC");
MODULE_AUTHOR("Martin Vaughan");
module_param(debug, bool, 0644);
MODULE_PARM_DESC(debug, "Debugging messages, 0=Off (default), 1=On");
struct v4l2_ctrl_handler hdl;
static inline struct cs53l32a_state *to_state(struct v4l2_subdev *sd)
return container_of(sd, struct cs53l32a_state, sd);
static inline struct v4l2_subdev *to_sd(struct v4l2_ctrl *ctrl)
return &container_of(ctrl->handler, struct cs53l32a_state, hdl)->sd;
static int cs53l32a_write(struct v4l2_subdev *sd, u8 reg, u8 value)
struct i2c_client *client = v4l2_get_subdevdata(sd);
return i2c_smbus_write_byte_data(client, reg, value);