static void fmi_set_freq(struct fmi *fmi) { fmi->curfreq = clamp(fmi->curfreq, RSF16_MINFREQ, RSF16_MAXFREQ); /* rounding in steps of 800 to match the freq that will be used */ lm7000_set_freq((fmi->curfreq / 800) * 800, fmi, fmi_set_pins); }
static int vidioc_s_frequency(struct file *file, void *priv, struct v4l2_frequency *f) { struct fmi *fmi = video_drvdata(file); if (f->tuner != 0 || f->type != V4L2_TUNER_RADIO) return -EINVAL; if (f->frequency < RSF16_MINFREQ || f->frequency > RSF16_MAXFREQ) return -EINVAL; /* rounding in steps of 800 to match the freq that will be used */ lm7000_set_freq((f->frequency / 800) * 800, fmi, fmi_set_pins); return 0; }