/* si4713_ioctl - deal with private ioctls (only rnl for now) */ static long si4713_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg) { struct si4713_device *sdev = to_si4713_device(sd); struct si4713_rnl *rnl = arg; u16 frequency; int rval = 0; if (!arg) return -EINVAL; switch (cmd) { case SI4713_IOC_MEASURE_RNL: frequency = v4l2_to_si4713(rnl->frequency); if (sdev->power_state) { /* Set desired measurement frequency */ rval = si4713_tx_tune_measure(sdev, frequency, 0); if (rval < 0) return rval; /* get results from tune status */ rval = si4713_update_tune_status(sdev); if (rval < 0) return rval; } rnl->rnl = sdev->tune_rnl; break; default: /* nothing */ rval = -ENOIOCTLCMD; } return rval; }
/* properties which use tx_tune_status */ static int si4713_read_econtrol_tune(struct si4713_device *sdev, struct v4l2_ext_control *control) { s32 rval = 0; mutex_lock(&sdev->mutex); if (sdev->power_state) { rval = si4713_update_tune_status(sdev); if (rval < 0) goto unlock; } switch (control->id) { case V4L2_CID_TUNE_POWER_LEVEL: control->value = sdev->power_level; break; case V4L2_CID_TUNE_ANTENNA_CAPACITOR: control->value = sdev->antenna_capacitor; break; default: rval = -EINVAL; }; unlock: mutex_unlock(&sdev->mutex); return rval; }