1 // SPDX-License-Identifier: GPL-2.0
5 * Copyright (C) 2017 Fuzhou Rockchip Electronics Co., Ltd.
9 #include <linux/device.h>
10 #include <linux/delay.h>
11 #include <linux/gpio/consumer.h>
12 #include <linux/i2c.h>
13 #include <linux/module.h>
14 #include <linux/pm_runtime.h>
15 #include <linux/regulator/consumer.h>
16 #include <linux/sysfs.h>
17 #include <media/media-entity.h>
18 #include <media/v4l2-async.h>
19 #include <media/v4l2-ctrls.h>
20 #include <media/v4l2-fwnode.h>
21 #include <media/v4l2-subdev.h>
23 #define CHIP_ID 0x2685
24 #define OV2685_REG_CHIP_ID 0x300a
26 #define OV2685_XVCLK_FREQ 24000000
28 #define REG_SC_CTRL_MODE 0x0100
29 #define SC_CTRL_MODE_STANDBY 0x0
30 #define SC_CTRL_MODE_STREAMING BIT(0)
32 #define OV2685_REG_EXPOSURE 0x3500
33 #define OV2685_EXPOSURE_MIN 4
34 #define OV2685_EXPOSURE_STEP 1
36 #define OV2685_REG_VTS 0x380e
37 #define OV2685_VTS_MAX 0x7fff
39 #define OV2685_REG_GAIN 0x350a
40 #define OV2685_GAIN_MIN 0
41 #define OV2685_GAIN_MAX 0x07ff
42 #define OV2685_GAIN_STEP 0x1
43 #define OV2685_GAIN_DEFAULT 0x0036
45 #define OV2685_REG_TEST_PATTERN 0x5080
46 #define OV2685_TEST_PATTERN_DISABLED 0x00
47 #define OV2685_TEST_PATTERN_COLOR_BAR 0x80
48 #define OV2685_TEST_PATTERN_RANDOM 0x81
49 #define OV2685_TEST_PATTERN_COLOR_BAR_FADE 0x88
50 #define OV2685_TEST_PATTERN_BW_SQUARE 0x92
51 #define OV2685_TEST_PATTERN_COLOR_SQUARE 0x82
53 #define REG_NULL 0xFFFF
55 #define OV2685_REG_VALUE_08BIT 1
56 #define OV2685_REG_VALUE_16BIT 2
57 #define OV2685_REG_VALUE_24BIT 3
59 #define OV2685_NATIVE_WIDTH 1616
60 #define OV2685_NATIVE_HEIGHT 1216
62 #define OV2685_LANES 1
63 #define OV2685_BITS_PER_SAMPLE 10
65 static const char * const ov2685_supply_names[] = {
66 "avdd", /* Analog power */
67 "dovdd", /* Digital I/O power */
68 "dvdd", /* Digital core power */
71 #define OV2685_NUM_SUPPLIES ARRAY_SIZE(ov2685_supply_names)
84 const struct v4l2_rect *analog_crop;
85 const struct regval *reg_list;
89 struct i2c_client *client;
91 struct gpio_desc *reset_gpio;
92 struct regulator_bulk_data supplies[OV2685_NUM_SUPPLIES];
96 struct v4l2_subdev subdev;
98 struct v4l2_ctrl *anal_gain;
99 struct v4l2_ctrl *exposure;
100 struct v4l2_ctrl *hblank;
101 struct v4l2_ctrl *vblank;
102 struct v4l2_ctrl *test_pattern;
103 struct v4l2_ctrl_handler ctrl_handler;
105 const struct ov2685_mode *cur_mode;
108 #define to_ov2685(sd) container_of(sd, struct ov2685, subdev)
110 /* PLL settings bases on 24M xvclk */
111 static struct regval ov2685_1600x1200_regs[] = {
215 #define OV2685_LINK_FREQ_330MHZ 330000000
216 static const s64 link_freq_menu_items[] = {
217 OV2685_LINK_FREQ_330MHZ
220 static const char * const ov2685_test_pattern_menu[] = {
225 "Black White Square",
229 static const int ov2685_test_pattern_val[] = {
230 OV2685_TEST_PATTERN_DISABLED,
231 OV2685_TEST_PATTERN_COLOR_BAR,
232 OV2685_TEST_PATTERN_COLOR_BAR_FADE,
233 OV2685_TEST_PATTERN_RANDOM,
234 OV2685_TEST_PATTERN_BW_SQUARE,
235 OV2685_TEST_PATTERN_COLOR_SQUARE,
238 static const struct v4l2_rect ov2685_analog_crop = {
245 static const struct ov2685_mode supported_modes[] = {
252 .analog_crop = &ov2685_analog_crop,
253 .reg_list = ov2685_1600x1200_regs,
257 /* Write registers up to 4 at a time */
258 static int ov2685_write_reg(struct i2c_client *client, u16 reg,
272 val_be = cpu_to_be32(val);
273 val_p = (u8 *)&val_be;
278 buf[buf_i++] = val_p[val_i++];
280 if (i2c_master_send(client, buf, len + 2) != len + 2)
286 static int ov2685_write_array(struct i2c_client *client,
287 const struct regval *regs)
292 for (i = 0; ret == 0 && regs[i].addr != REG_NULL; i++)
293 ret = ov2685_write_reg(client, regs[i].addr,
294 OV2685_REG_VALUE_08BIT, regs[i].val);
299 /* Read registers up to 4 at a time */
300 static int ov2685_read_reg(struct i2c_client *client, u16 reg,
303 struct i2c_msg msgs[2];
306 __be16 reg_addr_be = cpu_to_be16(reg);
312 data_be_p = (u8 *)&data_be;
313 /* Write register address */
314 msgs[0].addr = client->addr;
317 msgs[0].buf = (u8 *)®_addr_be;
319 /* Read data from register */
320 msgs[1].addr = client->addr;
321 msgs[1].flags = I2C_M_RD;
323 msgs[1].buf = &data_be_p[4 - len];
325 ret = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs));
326 if (ret != ARRAY_SIZE(msgs))
329 *val = be32_to_cpu(data_be);
334 static void ov2685_fill_fmt(const struct ov2685_mode *mode,
335 struct v4l2_mbus_framefmt *fmt)
337 fmt->code = MEDIA_BUS_FMT_SBGGR10_1X10;
338 fmt->width = mode->width;
339 fmt->height = mode->height;
340 fmt->field = V4L2_FIELD_NONE;
343 static int ov2685_set_fmt(struct v4l2_subdev *sd,
344 struct v4l2_subdev_state *sd_state,
345 struct v4l2_subdev_format *fmt)
347 struct ov2685 *ov2685 = to_ov2685(sd);
348 struct v4l2_mbus_framefmt *mbus_fmt = &fmt->format;
350 /* only one mode supported for now */
351 ov2685_fill_fmt(ov2685->cur_mode, mbus_fmt);
356 static int ov2685_get_fmt(struct v4l2_subdev *sd,
357 struct v4l2_subdev_state *sd_state,
358 struct v4l2_subdev_format *fmt)
360 struct ov2685 *ov2685 = to_ov2685(sd);
361 struct v4l2_mbus_framefmt *mbus_fmt = &fmt->format;
363 ov2685_fill_fmt(ov2685->cur_mode, mbus_fmt);
368 static int ov2685_enum_mbus_code(struct v4l2_subdev *sd,
369 struct v4l2_subdev_state *sd_state,
370 struct v4l2_subdev_mbus_code_enum *code)
372 if (code->index >= ARRAY_SIZE(supported_modes))
375 code->code = MEDIA_BUS_FMT_SBGGR10_1X10;
380 static int ov2685_enum_frame_sizes(struct v4l2_subdev *sd,
381 struct v4l2_subdev_state *sd_state,
382 struct v4l2_subdev_frame_size_enum *fse)
384 int index = fse->index;
386 if (index >= ARRAY_SIZE(supported_modes))
389 fse->code = MEDIA_BUS_FMT_SBGGR10_1X10;
391 fse->min_width = supported_modes[index].width;
392 fse->max_width = supported_modes[index].width;
393 fse->max_height = supported_modes[index].height;
394 fse->min_height = supported_modes[index].height;
399 static const struct v4l2_rect *
400 __ov2685_get_pad_crop(struct ov2685 *ov2685,
401 struct v4l2_subdev_state *state, unsigned int pad,
402 enum v4l2_subdev_format_whence which)
404 const struct ov2685_mode *mode = ov2685->cur_mode;
407 case V4L2_SUBDEV_FORMAT_TRY:
408 return v4l2_subdev_get_try_crop(&ov2685->subdev, state, pad);
409 case V4L2_SUBDEV_FORMAT_ACTIVE:
410 return mode->analog_crop;
416 static int ov2685_get_selection(struct v4l2_subdev *sd,
417 struct v4l2_subdev_state *sd_state,
418 struct v4l2_subdev_selection *sel)
420 struct ov2685 *ov2685 = to_ov2685(sd);
422 switch (sel->target) {
423 case V4L2_SEL_TGT_CROP:
424 mutex_lock(&ov2685->mutex);
425 sel->r = *__ov2685_get_pad_crop(ov2685, sd_state, sel->pad,
427 mutex_unlock(&ov2685->mutex);
429 case V4L2_SEL_TGT_NATIVE_SIZE:
430 case V4L2_SEL_TGT_CROP_BOUNDS:
433 sel->r.width = OV2685_NATIVE_WIDTH;
434 sel->r.height = OV2685_NATIVE_HEIGHT;
436 case V4L2_SEL_TGT_CROP_DEFAULT:
437 sel->r = ov2685_analog_crop;
446 /* Calculate the delay in us by clock rate and clock cycles */
447 static inline u32 ov2685_cal_delay(u32 cycles)
449 return DIV_ROUND_UP(cycles, OV2685_XVCLK_FREQ / 1000 / 1000);
452 static int __ov2685_power_on(struct ov2685 *ov2685)
456 struct device *dev = &ov2685->client->dev;
458 ret = clk_prepare_enable(ov2685->xvclk);
460 dev_err(dev, "Failed to enable xvclk\n");
464 gpiod_set_value_cansleep(ov2685->reset_gpio, 1);
466 ret = regulator_bulk_enable(OV2685_NUM_SUPPLIES, ov2685->supplies);
468 dev_err(dev, "Failed to enable regulators\n");
472 /* The minimum delay between power supplies and reset rising can be 0 */
473 gpiod_set_value_cansleep(ov2685->reset_gpio, 0);
474 /* 8192 xvclk cycles prior to the first SCCB transaction */
475 delay_us = ov2685_cal_delay(8192);
476 usleep_range(delay_us, delay_us * 2);
478 /* HACK: ov2685 would output messy data after reset(R0103),
479 * writing register before .s_stream() as a workaround
481 ret = ov2685_write_array(ov2685->client, ov2685->cur_mode->reg_list);
483 dev_err(dev, "Failed to set regs for power on\n");
484 goto disable_supplies;
490 regulator_bulk_disable(OV2685_NUM_SUPPLIES, ov2685->supplies);
492 clk_disable_unprepare(ov2685->xvclk);
497 static void __ov2685_power_off(struct ov2685 *ov2685)
499 /* 512 xvclk cycles after the last SCCB transaction or MIPI frame end */
500 u32 delay_us = ov2685_cal_delay(512);
502 usleep_range(delay_us, delay_us * 2);
503 clk_disable_unprepare(ov2685->xvclk);
504 gpiod_set_value_cansleep(ov2685->reset_gpio, 1);
505 regulator_bulk_disable(OV2685_NUM_SUPPLIES, ov2685->supplies);
508 static int ov2685_s_stream(struct v4l2_subdev *sd, int on)
510 struct ov2685 *ov2685 = to_ov2685(sd);
511 struct i2c_client *client = ov2685->client;
514 mutex_lock(&ov2685->mutex);
517 if (on == ov2685->streaming)
518 goto unlock_and_return;
521 ret = pm_runtime_resume_and_get(&ov2685->client->dev);
523 goto unlock_and_return;
525 ret = __v4l2_ctrl_handler_setup(&ov2685->ctrl_handler);
527 pm_runtime_put(&client->dev);
528 goto unlock_and_return;
530 ret = ov2685_write_reg(client, REG_SC_CTRL_MODE,
531 OV2685_REG_VALUE_08BIT, SC_CTRL_MODE_STREAMING);
533 pm_runtime_put(&client->dev);
534 goto unlock_and_return;
537 ov2685_write_reg(client, REG_SC_CTRL_MODE,
538 OV2685_REG_VALUE_08BIT, SC_CTRL_MODE_STANDBY);
539 pm_runtime_put(&ov2685->client->dev);
542 ov2685->streaming = on;
545 mutex_unlock(&ov2685->mutex);
550 #ifdef CONFIG_VIDEO_V4L2_SUBDEV_API
551 static int ov2685_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
553 struct ov2685 *ov2685 = to_ov2685(sd);
554 struct v4l2_mbus_framefmt *try_fmt;
556 mutex_lock(&ov2685->mutex);
558 try_fmt = v4l2_subdev_get_try_format(sd, fh->state, 0);
559 /* Initialize try_fmt */
560 ov2685_fill_fmt(&supported_modes[0], try_fmt);
562 mutex_unlock(&ov2685->mutex);
568 static int __maybe_unused ov2685_runtime_resume(struct device *dev)
570 struct v4l2_subdev *sd = dev_get_drvdata(dev);
571 struct ov2685 *ov2685 = to_ov2685(sd);
573 return __ov2685_power_on(ov2685);
576 static int __maybe_unused ov2685_runtime_suspend(struct device *dev)
578 struct v4l2_subdev *sd = dev_get_drvdata(dev);
579 struct ov2685 *ov2685 = to_ov2685(sd);
581 __ov2685_power_off(ov2685);
586 static const struct dev_pm_ops ov2685_pm_ops = {
587 SET_RUNTIME_PM_OPS(ov2685_runtime_suspend,
588 ov2685_runtime_resume, NULL)
591 static int ov2685_set_ctrl(struct v4l2_ctrl *ctrl)
593 struct ov2685 *ov2685 = container_of(ctrl->handler,
594 struct ov2685, ctrl_handler);
595 struct i2c_client *client = ov2685->client;
599 /* Propagate change of current control to all related controls */
601 case V4L2_CID_VBLANK:
602 /* Update max exposure while meeting expected vblanking */
603 max_expo = ov2685->cur_mode->height + ctrl->val - 4;
604 __v4l2_ctrl_modify_range(ov2685->exposure,
605 ov2685->exposure->minimum, max_expo,
606 ov2685->exposure->step,
607 ov2685->exposure->default_value);
611 if (!pm_runtime_get_if_in_use(&client->dev))
615 case V4L2_CID_EXPOSURE:
616 ret = ov2685_write_reg(ov2685->client, OV2685_REG_EXPOSURE,
617 OV2685_REG_VALUE_24BIT, ctrl->val << 4);
619 case V4L2_CID_ANALOGUE_GAIN:
620 ret = ov2685_write_reg(ov2685->client, OV2685_REG_GAIN,
621 OV2685_REG_VALUE_16BIT, ctrl->val);
623 case V4L2_CID_VBLANK:
624 ret = ov2685_write_reg(ov2685->client, OV2685_REG_VTS,
625 OV2685_REG_VALUE_16BIT,
626 ctrl->val + ov2685->cur_mode->height);
628 case V4L2_CID_TEST_PATTERN:
629 ret = ov2685_write_reg(ov2685->client, OV2685_REG_TEST_PATTERN,
630 OV2685_REG_VALUE_08BIT,
631 ov2685_test_pattern_val[ctrl->val]);
634 dev_warn(&client->dev, "%s Unhandled id:0x%x, val:0x%x\n",
635 __func__, ctrl->id, ctrl->val);
640 pm_runtime_put(&client->dev);
645 static const struct v4l2_subdev_video_ops ov2685_video_ops = {
646 .s_stream = ov2685_s_stream,
649 static const struct v4l2_subdev_pad_ops ov2685_pad_ops = {
650 .enum_mbus_code = ov2685_enum_mbus_code,
651 .enum_frame_size = ov2685_enum_frame_sizes,
652 .get_fmt = ov2685_get_fmt,
653 .set_fmt = ov2685_set_fmt,
654 .get_selection = ov2685_get_selection,
655 .set_selection = ov2685_get_selection,
658 static const struct v4l2_subdev_ops ov2685_subdev_ops = {
659 .video = &ov2685_video_ops,
660 .pad = &ov2685_pad_ops,
663 #ifdef CONFIG_VIDEO_V4L2_SUBDEV_API
664 static const struct v4l2_subdev_internal_ops ov2685_internal_ops = {
669 static const struct v4l2_ctrl_ops ov2685_ctrl_ops = {
670 .s_ctrl = ov2685_set_ctrl,
673 static int ov2685_initialize_controls(struct ov2685 *ov2685)
675 const struct ov2685_mode *mode;
676 struct v4l2_ctrl_handler *handler;
677 struct v4l2_ctrl *ctrl;
678 struct v4l2_fwnode_device_properties props;
680 u32 pixel_rate, h_blank;
683 handler = &ov2685->ctrl_handler;
684 mode = ov2685->cur_mode;
685 ret = v4l2_ctrl_handler_init(handler, 10);
688 handler->lock = &ov2685->mutex;
690 ctrl = v4l2_ctrl_new_int_menu(handler, NULL, V4L2_CID_LINK_FREQ,
691 0, 0, link_freq_menu_items);
693 ctrl->flags |= V4L2_CTRL_FLAG_READ_ONLY;
695 pixel_rate = (link_freq_menu_items[0] * 2 * OV2685_LANES) /
696 OV2685_BITS_PER_SAMPLE;
697 v4l2_ctrl_new_std(handler, NULL, V4L2_CID_PIXEL_RATE,
698 0, pixel_rate, 1, pixel_rate);
700 h_blank = mode->hts_def - mode->width;
701 ov2685->hblank = v4l2_ctrl_new_std(handler, NULL, V4L2_CID_HBLANK,
702 h_blank, h_blank, 1, h_blank);
704 ov2685->hblank->flags |= V4L2_CTRL_FLAG_READ_ONLY;
706 ov2685->vblank = v4l2_ctrl_new_std(handler, &ov2685_ctrl_ops,
707 V4L2_CID_VBLANK, mode->vts_def - mode->height,
708 OV2685_VTS_MAX - mode->height, 1,
709 mode->vts_def - mode->height);
711 exposure_max = mode->vts_def - 4;
712 ov2685->exposure = v4l2_ctrl_new_std(handler, &ov2685_ctrl_ops,
713 V4L2_CID_EXPOSURE, OV2685_EXPOSURE_MIN,
714 exposure_max, OV2685_EXPOSURE_STEP,
717 ov2685->anal_gain = v4l2_ctrl_new_std(handler, &ov2685_ctrl_ops,
718 V4L2_CID_ANALOGUE_GAIN, OV2685_GAIN_MIN,
719 OV2685_GAIN_MAX, OV2685_GAIN_STEP,
720 OV2685_GAIN_DEFAULT);
722 ov2685->test_pattern = v4l2_ctrl_new_std_menu_items(handler,
723 &ov2685_ctrl_ops, V4L2_CID_TEST_PATTERN,
724 ARRAY_SIZE(ov2685_test_pattern_menu) - 1,
725 0, 0, ov2685_test_pattern_menu);
727 /* set properties from fwnode (e.g. rotation, orientation) */
728 ret = v4l2_fwnode_device_parse(&ov2685->client->dev, &props);
730 goto err_free_handler;
732 ret = v4l2_ctrl_new_fwnode_properties(handler, &ov2685_ctrl_ops, &props);
734 goto err_free_handler;
736 if (handler->error) {
737 ret = handler->error;
738 dev_err(&ov2685->client->dev,
739 "Failed to init controls(%d)\n", ret);
740 goto err_free_handler;
743 ov2685->subdev.ctrl_handler = handler;
748 v4l2_ctrl_handler_free(handler);
753 static int ov2685_check_sensor_id(struct ov2685 *ov2685,
754 struct i2c_client *client)
756 struct device *dev = &ov2685->client->dev;
760 ret = ov2685_read_reg(client, OV2685_REG_CHIP_ID,
761 OV2685_REG_VALUE_16BIT, &id);
763 dev_err(dev, "Unexpected sensor id(%04x), ret(%d)\n", id, ret);
767 dev_info(dev, "Detected OV%04x sensor\n", CHIP_ID);
772 static int ov2685_configure_regulators(struct ov2685 *ov2685)
776 for (i = 0; i < OV2685_NUM_SUPPLIES; i++)
777 ov2685->supplies[i].supply = ov2685_supply_names[i];
779 return devm_regulator_bulk_get(&ov2685->client->dev,
784 static int ov2685_probe(struct i2c_client *client)
786 struct device *dev = &client->dev;
787 struct ov2685 *ov2685;
790 ov2685 = devm_kzalloc(dev, sizeof(*ov2685), GFP_KERNEL);
794 ov2685->client = client;
795 ov2685->cur_mode = &supported_modes[0];
797 ov2685->xvclk = devm_clk_get(dev, "xvclk");
798 if (IS_ERR(ov2685->xvclk)) {
799 dev_err(dev, "Failed to get xvclk\n");
802 ret = clk_set_rate(ov2685->xvclk, OV2685_XVCLK_FREQ);
804 dev_err(dev, "Failed to set xvclk rate (24MHz)\n");
807 if (clk_get_rate(ov2685->xvclk) != OV2685_XVCLK_FREQ)
808 dev_warn(dev, "xvclk mismatched, modes are based on 24MHz\n");
810 ov2685->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
811 if (IS_ERR(ov2685->reset_gpio)) {
812 dev_err(dev, "Failed to get reset-gpios\n");
816 ret = ov2685_configure_regulators(ov2685);
818 dev_err(dev, "Failed to get power regulators\n");
822 mutex_init(&ov2685->mutex);
823 v4l2_i2c_subdev_init(&ov2685->subdev, client, &ov2685_subdev_ops);
824 ret = ov2685_initialize_controls(ov2685);
826 goto err_destroy_mutex;
828 ret = __ov2685_power_on(ov2685);
830 goto err_free_handler;
832 ret = ov2685_check_sensor_id(ov2685, client);
836 #ifdef CONFIG_VIDEO_V4L2_SUBDEV_API
837 ov2685->subdev.internal_ops = &ov2685_internal_ops;
838 ov2685->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
840 #if defined(CONFIG_MEDIA_CONTROLLER)
841 ov2685->pad.flags = MEDIA_PAD_FL_SOURCE;
842 ov2685->subdev.entity.function = MEDIA_ENT_F_CAM_SENSOR;
843 ret = media_entity_pads_init(&ov2685->subdev.entity, 1, &ov2685->pad);
848 ret = v4l2_async_register_subdev(&ov2685->subdev);
850 dev_err(dev, "v4l2 async register subdev failed\n");
851 goto err_clean_entity;
854 pm_runtime_set_active(dev);
855 pm_runtime_enable(dev);
856 pm_runtime_idle(dev);
861 #if defined(CONFIG_MEDIA_CONTROLLER)
862 media_entity_cleanup(&ov2685->subdev.entity);
865 __ov2685_power_off(ov2685);
867 v4l2_ctrl_handler_free(&ov2685->ctrl_handler);
869 mutex_destroy(&ov2685->mutex);
874 static void ov2685_remove(struct i2c_client *client)
876 struct v4l2_subdev *sd = i2c_get_clientdata(client);
877 struct ov2685 *ov2685 = to_ov2685(sd);
879 v4l2_async_unregister_subdev(sd);
880 #if defined(CONFIG_MEDIA_CONTROLLER)
881 media_entity_cleanup(&sd->entity);
883 v4l2_ctrl_handler_free(&ov2685->ctrl_handler);
884 mutex_destroy(&ov2685->mutex);
886 pm_runtime_disable(&client->dev);
887 if (!pm_runtime_status_suspended(&client->dev))
888 __ov2685_power_off(ov2685);
889 pm_runtime_set_suspended(&client->dev);
892 #if IS_ENABLED(CONFIG_OF)
893 static const struct of_device_id ov2685_of_match[] = {
894 { .compatible = "ovti,ov2685" },
897 MODULE_DEVICE_TABLE(of, ov2685_of_match);
900 static struct i2c_driver ov2685_i2c_driver = {
903 .pm = &ov2685_pm_ops,
904 .of_match_table = of_match_ptr(ov2685_of_match),
906 .probe = ov2685_probe,
907 .remove = ov2685_remove,
910 module_i2c_driver(ov2685_i2c_driver);
912 MODULE_DESCRIPTION("OmniVision ov2685 sensor driver");
913 MODULE_LICENSE("GPL v2");