Beispiel #1
0
/* Set status of additional camera capabilities */
static int gc0329_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
{
	struct gc0329_priv *priv = to_gc0329(sd);
	struct i2c_client *client =
			(struct i2c_client *) v4l2_get_subdevdata(sd);

	switch (ctrl->id) {
	case V4L2_CID_VFLIP:
		priv->flag_vflip = ctrl->value;
		return set_flip(client, priv->flag_vflip);
		break;
	case V4L2_CID_HFLIP:
		priv->flag_hflip = ctrl->value;
		PDBG("set H-FLIP:%d\n", priv->flag_hflip);
		return set_mirror(client, priv->flag_hflip);
		break;
	case V4L2_CID_BRIGHTNESS:
		if (ctrl->value < -4 || ctrl->value > 4) {
			return -EINVAL;
		}
                priv->brightness = ctrl->value;
		return set_brightness(client, priv->brightness);
                break;
	case V4L2_CID_CONTRAST:
		if (ctrl->value < -3 || ctrl->value > 3) {
			return -EINVAL;
		}
                priv->contrast = ctrl->value;
		return set_contrast(client, priv->contrast);
                break;
	case V4L2_CID_SATURATION:
		if (ctrl->value < -3 || ctrl->value > 3) {
			return -EINVAL;
		}
                priv->sat = ctrl->value;
		return set_sat(client, priv->sat);
                break;
	case V4L2_CID_CAMERA_SPECIAL_EFFECT:
		if (ctrl->value < 0 || ctrl->value > 8) {
			return -EINVAL;
		}
                priv->effect = ctrl->value;
		return set_effect(client, priv->effect);
                break;
	case V4L2_CID_DO_WHITE_BALANCE:
		if (ctrl->value < 0 || ctrl->value > 4) {
			return -EINVAL;
		}
                priv->wh_bal = ctrl->value;
		return set_wh_bal(client, priv->wh_bal);
                break;
	default:
		return -EINVAL;
	}

	return 0;
}
Beispiel #2
0
/* Start/Stop streaming from the device */
static int gc0309_s_stream(struct v4l2_subdev *sd, int enable)
{
    struct i2c_client *client = v4l2_get_subdevdata(sd);
    struct gc0309_priv *priv = to_gc0309(sd);
    int ret = 0;

    /* Program orientation register. */
    ret = set_flip(client, priv->flag_vflip);
    if (ret < 0)
        return ret;

    ret = set_brightness(client, priv->brightness);
    if (ret < 0)
        return ret;

    ret = set_contrast(client, priv->contrast);
    if (ret < 0)
        return ret;

    ret = set_sat(client, priv->sat);
    if (ret < 0)
        return ret;

    ret = set_effect(client, priv->effect);
    if (ret < 0)
        return ret;

    ret = set_wh_bal(client, priv->wh_bal);
    if (ret < 0)
        return ret;

    ret = set_mirror(client, priv->flag_hflip);
    if (ret < 0)
        return ret;

    if (enable) {
        PDBG("Enabling Streaming\n");
        /* Start Streaming */
        ret = gc0309_write(client, 0x25, 0x0f);
        if (ret)
            goto out;
        
    } else {
        PDBG( "Disabling Streaming\n");
        
        ret = gc0309_write(client, 0x25, 0x00);
    }

out:
    return ret;
}
Beispiel #3
0
/* Start/Stop streaming from the device */
static int gc0329_s_stream(struct v4l2_subdev *sd, int enable)
{
	struct i2c_client *client = v4l2_get_subdevdata(sd);
	struct gc0329_priv *priv = to_gc0329(sd);
	int ret = 0;
	u8 val;

	/* Program orientation register. */
	ret = set_flip(client, priv->flag_vflip);
	if (ret < 0)
		return ret;

	ret = set_brightness(client, priv->brightness);
	if (ret < 0)
		return ret;

	ret = set_contrast(client, priv->contrast);
	if (ret < 0)
		return ret;

	ret = set_sat(client, priv->sat);
	if (ret < 0)
		return ret;

	ret = set_effect(client, priv->effect);
	if (ret < 0)
		return ret;

	ret = set_wh_bal(client, priv->wh_bal);
	if (ret < 0)
		return ret;

	ret = set_mirror(client, priv->flag_hflip);
	if (ret < 0)
		return ret;

	if (enable) {
		dev_dbg(&client->dev, "Enabling Streaming\n");
		/* Start Streaming */
	} else {
		dev_dbg(&client->dev, "Disabling Streaming\n");
	}



out:
	return ret;
}
Beispiel #4
0
static int gc0311_s_stream(struct v4l2_subdev *sd, int enable)
{
    struct i2c_client *client = v4l2_get_subdevdata(sd);
    struct gc0311_priv *priv = to_gc0311(sd);
    int ret = 0;

    ret = set_flip(client, priv->flag_vflip);
    if (ret < 0)
        return ret;

    ret = set_brightness(client, priv->brightness);
    if (ret < 0)
        return ret;

    ret = set_contrast(client, priv->contrast);
    if (ret < 0)
        return ret;

    ret = set_sat(client, priv->sat);
    if (ret < 0)
        return ret;

    ret = set_effect(client, priv->effect);
    if (ret < 0)
        return ret;

    ret = set_wh_bal(client, priv->wh_bal);
    if (ret < 0)
        return ret;

    ret = set_mirror(client, priv->flag_hflip);
    if (ret < 0)
        return ret;

    if (enable) {
        ret = gc0311_write(client, 0x25, 0x0f);
        if (ret)
            goto out;
    } else {
        ret = gc0311_write(client, 0x25, 0x00);
    }

out:
    return ret;
}