#include <linux/module.h>
#include <linux/gcd.h>
#include <media/v4l2-device.h>
#include <media/v4l2-ctrls.h>
static const struct v4l2_frequency_band bands[] = …;
struct msi001_dev { … };
static inline struct msi001_dev *sd_to_msi001_dev(struct v4l2_subdev *sd)
{ … }
static int msi001_wreg(struct msi001_dev *dev, u32 data)
{
return spi_write(dev->spi, &data, 3);
};
static int msi001_set_gain(struct msi001_dev *dev, int lna_gain, int mixer_gain,
int if_gain)
{
struct spi_device *spi = dev->spi;
int ret;
u32 reg;
dev_dbg(&spi->dev, "lna=%d mixer=%d if=%d\n",
lna_gain, mixer_gain, if_gain);
reg = 1 << 0;
reg |= (59 - if_gain) << 4;
reg |= 0 << 10;
reg |= (1 - mixer_gain) << 12;
reg |= (1 - lna_gain) << 13;
reg |= 4 << 14;
reg |= 0 << 17;
ret = msi001_wreg(dev, reg);
if (ret)
goto err;
return 0;
err:
dev_dbg(&spi->dev, "failed %d\n", ret);
return ret;
};
static int msi001_set_tuner(struct msi001_dev *dev)
{ … }
static int msi001_standby(struct v4l2_subdev *sd)
{ … }
static int msi001_g_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *v)
{ … }
static int msi001_s_tuner(struct v4l2_subdev *sd, const struct v4l2_tuner *v)
{ … }
static int msi001_g_frequency(struct v4l2_subdev *sd, struct v4l2_frequency *f)
{ … }
static int msi001_s_frequency(struct v4l2_subdev *sd,
const struct v4l2_frequency *f)
{ … }
static int msi001_enum_freq_bands(struct v4l2_subdev *sd,
struct v4l2_frequency_band *band)
{ … }
static const struct v4l2_subdev_tuner_ops msi001_tuner_ops = …;
static const struct v4l2_subdev_ops msi001_ops = …;
static int msi001_s_ctrl(struct v4l2_ctrl *ctrl)
{ … }
static const struct v4l2_ctrl_ops msi001_ctrl_ops = …;
static int msi001_probe(struct spi_device *spi)
{ … }
static void msi001_remove(struct spi_device *spi)
{ … }
static const struct spi_device_id msi001_id_table[] = …;
MODULE_DEVICE_TABLE(spi, msi001_id_table);
static struct spi_driver msi001_driver = …;
module_spi_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;