2 * ADE7758 Poly Phase Multifunction Energy Metering IC driver
4 * Copyright 2010-2011 Analog Devices Inc.
6 * Licensed under the GPL-2.
9 #include <linux/interrupt.h>
10 #include <linux/irq.h>
11 #include <linux/delay.h>
12 #include <linux/mutex.h>
13 #include <linux/device.h>
14 #include <linux/kernel.h>
15 #include <linux/spi/spi.h>
16 #include <linux/slab.h>
17 #include <linux/sysfs.h>
18 #include <linux/list.h>
19 #include <linux/module.h>
21 #include <linux/iio/iio.h>
22 #include <linux/iio/sysfs.h>
23 #include <linux/iio/buffer.h>
27 int ade7758_spi_write_reg_8(struct device
*dev
,
32 struct iio_dev
*indio_dev
= dev_to_iio_dev(dev
);
33 struct ade7758_state
*st
= iio_priv(indio_dev
);
35 mutex_lock(&st
->buf_lock
);
36 st
->tx
[0] = ADE7758_WRITE_REG(reg_address
);
39 ret
= spi_write(st
->us
, st
->tx
, 2);
40 mutex_unlock(&st
->buf_lock
);
45 static int ade7758_spi_write_reg_16(struct device
*dev
,
50 struct spi_message msg
;
51 struct iio_dev
*indio_dev
= dev_to_iio_dev(dev
);
52 struct ade7758_state
*st
= iio_priv(indio_dev
);
53 struct spi_transfer xfers
[] = {
61 mutex_lock(&st
->buf_lock
);
62 st
->tx
[0] = ADE7758_WRITE_REG(reg_address
);
63 st
->tx
[1] = (value
>> 8) & 0xFF;
64 st
->tx
[2] = value
& 0xFF;
66 spi_message_init(&msg
);
67 spi_message_add_tail(xfers
, &msg
);
68 ret
= spi_sync(st
->us
, &msg
);
69 mutex_unlock(&st
->buf_lock
);
74 static int ade7758_spi_write_reg_24(struct device
*dev
,
79 struct spi_message msg
;
80 struct iio_dev
*indio_dev
= dev_to_iio_dev(dev
);
81 struct ade7758_state
*st
= iio_priv(indio_dev
);
82 struct spi_transfer xfers
[] = {
90 mutex_lock(&st
->buf_lock
);
91 st
->tx
[0] = ADE7758_WRITE_REG(reg_address
);
92 st
->tx
[1] = (value
>> 16) & 0xFF;
93 st
->tx
[2] = (value
>> 8) & 0xFF;
94 st
->tx
[3] = value
& 0xFF;
96 spi_message_init(&msg
);
97 spi_message_add_tail(xfers
, &msg
);
98 ret
= spi_sync(st
->us
, &msg
);
99 mutex_unlock(&st
->buf_lock
);
104 int ade7758_spi_read_reg_8(struct device
*dev
,
108 struct spi_message msg
;
109 struct iio_dev
*indio_dev
= dev_to_iio_dev(dev
);
110 struct ade7758_state
*st
= iio_priv(indio_dev
);
112 struct spi_transfer xfers
[] = {
120 .tx_buf
= &st
->tx
[1],
127 mutex_lock(&st
->buf_lock
);
128 st
->tx
[0] = ADE7758_READ_REG(reg_address
);
131 spi_message_init(&msg
);
132 spi_message_add_tail(&xfers
[0], &msg
);
133 spi_message_add_tail(&xfers
[1], &msg
);
134 ret
= spi_sync(st
->us
, &msg
);
136 dev_err(&st
->us
->dev
, "problem when reading 8 bit register 0x%02X",
143 mutex_unlock(&st
->buf_lock
);
147 static int ade7758_spi_read_reg_16(struct device
*dev
,
151 struct spi_message msg
;
152 struct iio_dev
*indio_dev
= dev_to_iio_dev(dev
);
153 struct ade7758_state
*st
= iio_priv(indio_dev
);
155 struct spi_transfer xfers
[] = {
163 .tx_buf
= &st
->tx
[1],
171 mutex_lock(&st
->buf_lock
);
172 st
->tx
[0] = ADE7758_READ_REG(reg_address
);
176 spi_message_init(&msg
);
177 spi_message_add_tail(&xfers
[0], &msg
);
178 spi_message_add_tail(&xfers
[1], &msg
);
179 ret
= spi_sync(st
->us
, &msg
);
181 dev_err(&st
->us
->dev
, "problem when reading 16 bit register 0x%02X",
186 *val
= (st
->rx
[0] << 8) | st
->rx
[1];
189 mutex_unlock(&st
->buf_lock
);
193 static int ade7758_spi_read_reg_24(struct device
*dev
,
197 struct spi_message msg
;
198 struct iio_dev
*indio_dev
= dev_to_iio_dev(dev
);
199 struct ade7758_state
*st
= iio_priv(indio_dev
);
201 struct spi_transfer xfers
[] = {
209 .tx_buf
= &st
->tx
[1],
216 mutex_lock(&st
->buf_lock
);
217 st
->tx
[0] = ADE7758_READ_REG(reg_address
);
222 spi_message_init(&msg
);
223 spi_message_add_tail(&xfers
[0], &msg
);
224 spi_message_add_tail(&xfers
[1], &msg
);
225 ret
= spi_sync(st
->us
, &msg
);
227 dev_err(&st
->us
->dev
, "problem when reading 24 bit register 0x%02X",
231 *val
= (st
->rx
[0] << 16) | (st
->rx
[1] << 8) | st
->rx
[2];
234 mutex_unlock(&st
->buf_lock
);
238 static ssize_t
ade7758_read_8bit(struct device
*dev
,
239 struct device_attribute
*attr
,
244 struct iio_dev_attr
*this_attr
= to_iio_dev_attr(attr
);
246 ret
= ade7758_spi_read_reg_8(dev
, this_attr
->address
, &val
);
250 return sprintf(buf
, "%u\n", val
);
253 static ssize_t
ade7758_read_16bit(struct device
*dev
,
254 struct device_attribute
*attr
,
259 struct iio_dev_attr
*this_attr
= to_iio_dev_attr(attr
);
261 ret
= ade7758_spi_read_reg_16(dev
, this_attr
->address
, &val
);
265 return sprintf(buf
, "%u\n", val
);
268 static ssize_t
ade7758_read_24bit(struct device
*dev
,
269 struct device_attribute
*attr
,
274 struct iio_dev_attr
*this_attr
= to_iio_dev_attr(attr
);
276 ret
= ade7758_spi_read_reg_24(dev
, this_attr
->address
, &val
);
280 return sprintf(buf
, "%u\n", val
& 0xFFFFFF);
283 static ssize_t
ade7758_write_8bit(struct device
*dev
,
284 struct device_attribute
*attr
,
288 struct iio_dev_attr
*this_attr
= to_iio_dev_attr(attr
);
292 ret
= strict_strtol(buf
, 10, &val
);
295 ret
= ade7758_spi_write_reg_8(dev
, this_attr
->address
, val
);
298 return ret
? ret
: len
;
301 static ssize_t
ade7758_write_16bit(struct device
*dev
,
302 struct device_attribute
*attr
,
306 struct iio_dev_attr
*this_attr
= to_iio_dev_attr(attr
);
310 ret
= strict_strtol(buf
, 10, &val
);
313 ret
= ade7758_spi_write_reg_16(dev
, this_attr
->address
, val
);
316 return ret
? ret
: len
;
319 static int ade7758_reset(struct device
*dev
)
323 ade7758_spi_read_reg_8(dev
,
326 val
|= 1 << 6; /* Software Chip Reset */
327 ret
= ade7758_spi_write_reg_8(dev
,
334 static ssize_t
ade7758_write_reset(struct device
*dev
,
335 struct device_attribute
*attr
,
336 const char *buf
, size_t len
)
344 return ade7758_reset(dev
);
349 static IIO_DEV_ATTR_VPEAK(S_IWUSR
| S_IRUGO
,
353 static IIO_DEV_ATTR_IPEAK(S_IWUSR
| S_IRUGO
,
357 static IIO_DEV_ATTR_APHCAL(S_IWUSR
| S_IRUGO
,
361 static IIO_DEV_ATTR_BPHCAL(S_IWUSR
| S_IRUGO
,
365 static IIO_DEV_ATTR_CPHCAL(S_IWUSR
| S_IRUGO
,
369 static IIO_DEV_ATTR_WDIV(S_IWUSR
| S_IRUGO
,
373 static IIO_DEV_ATTR_VADIV(S_IWUSR
| S_IRUGO
,
377 static IIO_DEV_ATTR_AIRMS(S_IRUGO
,
381 static IIO_DEV_ATTR_BIRMS(S_IRUGO
,
385 static IIO_DEV_ATTR_CIRMS(S_IRUGO
,
389 static IIO_DEV_ATTR_AVRMS(S_IRUGO
,
393 static IIO_DEV_ATTR_BVRMS(S_IRUGO
,
397 static IIO_DEV_ATTR_CVRMS(S_IRUGO
,
401 static IIO_DEV_ATTR_AIRMSOS(S_IWUSR
| S_IRUGO
,
405 static IIO_DEV_ATTR_BIRMSOS(S_IWUSR
| S_IRUGO
,
409 static IIO_DEV_ATTR_CIRMSOS(S_IWUSR
| S_IRUGO
,
413 static IIO_DEV_ATTR_AVRMSOS(S_IWUSR
| S_IRUGO
,
417 static IIO_DEV_ATTR_BVRMSOS(S_IWUSR
| S_IRUGO
,
421 static IIO_DEV_ATTR_CVRMSOS(S_IWUSR
| S_IRUGO
,
425 static IIO_DEV_ATTR_AIGAIN(S_IWUSR
| S_IRUGO
,
429 static IIO_DEV_ATTR_BIGAIN(S_IWUSR
| S_IRUGO
,
433 static IIO_DEV_ATTR_CIGAIN(S_IWUSR
| S_IRUGO
,
437 static IIO_DEV_ATTR_AVRMSGAIN(S_IWUSR
| S_IRUGO
,
441 static IIO_DEV_ATTR_BVRMSGAIN(S_IWUSR
| S_IRUGO
,
445 static IIO_DEV_ATTR_CVRMSGAIN(S_IWUSR
| S_IRUGO
,
450 int ade7758_set_irq(struct device
*dev
, bool enable
)
454 ret
= ade7758_spi_read_reg_24(dev
, ADE7758_MASK
, &irqen
);
459 irqen
|= 1 << 16; /* Enables an interrupt when a data is
460 present in the waveform register */
464 ret
= ade7758_spi_write_reg_24(dev
, ADE7758_MASK
, irqen
);
472 /* Power down the device */
473 static int ade7758_stop_device(struct device
*dev
)
477 ade7758_spi_read_reg_8(dev
,
480 val
|= 7 << 3; /* ADE7758 powered down */
481 ret
= ade7758_spi_write_reg_8(dev
,
488 static int ade7758_initial_setup(struct iio_dev
*indio_dev
)
490 struct ade7758_state
*st
= iio_priv(indio_dev
);
491 struct device
*dev
= &indio_dev
->dev
;
494 /* use low spi speed for init */
495 st
->us
->mode
= SPI_MODE_1
;
499 ret
= ade7758_set_irq(dev
, false);
501 dev_err(dev
, "disable irq failed");
506 msleep(ADE7758_STARTUP_DELAY
);
512 static ssize_t
ade7758_read_frequency(struct device
*dev
,
513 struct device_attribute
*attr
,
519 ret
= ade7758_spi_read_reg_8(dev
,
526 sps
= 26040 / (1 << t
);
528 len
= sprintf(buf
, "%d SPS\n", sps
);
532 static ssize_t
ade7758_write_frequency(struct device
*dev
,
533 struct device_attribute
*attr
,
537 struct iio_dev
*indio_dev
= dev_to_iio_dev(dev
);
542 ret
= strict_strtol(buf
, 10, &val
);
546 mutex_lock(&indio_dev
->mlock
);
566 ret
= ade7758_spi_read_reg_8(dev
,
575 ret
= ade7758_spi_write_reg_8(dev
,
580 mutex_unlock(&indio_dev
->mlock
);
582 return ret
? ret
: len
;
585 static IIO_DEV_ATTR_TEMP_RAW(ade7758_read_8bit
);
586 static IIO_CONST_ATTR(in_temp_offset
, "129 C");
587 static IIO_CONST_ATTR(in_temp_scale
, "4 C");
589 static IIO_DEV_ATTR_AWATTHR(ade7758_read_16bit
,
591 static IIO_DEV_ATTR_BWATTHR(ade7758_read_16bit
,
593 static IIO_DEV_ATTR_CWATTHR(ade7758_read_16bit
,
595 static IIO_DEV_ATTR_AVARHR(ade7758_read_16bit
,
597 static IIO_DEV_ATTR_BVARHR(ade7758_read_16bit
,
599 static IIO_DEV_ATTR_CVARHR(ade7758_read_16bit
,
601 static IIO_DEV_ATTR_AVAHR(ade7758_read_16bit
,
603 static IIO_DEV_ATTR_BVAHR(ade7758_read_16bit
,
605 static IIO_DEV_ATTR_CVAHR(ade7758_read_16bit
,
608 static IIO_DEV_ATTR_SAMP_FREQ(S_IWUSR
| S_IRUGO
,
609 ade7758_read_frequency
,
610 ade7758_write_frequency
);
612 static IIO_DEV_ATTR_RESET(ade7758_write_reset
);
614 static IIO_CONST_ATTR_SAMP_FREQ_AVAIL("26040 13020 6510 3255");
616 static struct attribute
*ade7758_attributes
[] = {
617 &iio_dev_attr_in_temp_raw
.dev_attr
.attr
,
618 &iio_const_attr_in_temp_offset
.dev_attr
.attr
,
619 &iio_const_attr_in_temp_scale
.dev_attr
.attr
,
620 &iio_dev_attr_sampling_frequency
.dev_attr
.attr
,
621 &iio_const_attr_sampling_frequency_available
.dev_attr
.attr
,
622 &iio_dev_attr_reset
.dev_attr
.attr
,
623 &iio_dev_attr_awatthr
.dev_attr
.attr
,
624 &iio_dev_attr_bwatthr
.dev_attr
.attr
,
625 &iio_dev_attr_cwatthr
.dev_attr
.attr
,
626 &iio_dev_attr_avarhr
.dev_attr
.attr
,
627 &iio_dev_attr_bvarhr
.dev_attr
.attr
,
628 &iio_dev_attr_cvarhr
.dev_attr
.attr
,
629 &iio_dev_attr_avahr
.dev_attr
.attr
,
630 &iio_dev_attr_bvahr
.dev_attr
.attr
,
631 &iio_dev_attr_cvahr
.dev_attr
.attr
,
632 &iio_dev_attr_vpeak
.dev_attr
.attr
,
633 &iio_dev_attr_ipeak
.dev_attr
.attr
,
634 &iio_dev_attr_aphcal
.dev_attr
.attr
,
635 &iio_dev_attr_bphcal
.dev_attr
.attr
,
636 &iio_dev_attr_cphcal
.dev_attr
.attr
,
637 &iio_dev_attr_wdiv
.dev_attr
.attr
,
638 &iio_dev_attr_vadiv
.dev_attr
.attr
,
639 &iio_dev_attr_airms
.dev_attr
.attr
,
640 &iio_dev_attr_birms
.dev_attr
.attr
,
641 &iio_dev_attr_cirms
.dev_attr
.attr
,
642 &iio_dev_attr_avrms
.dev_attr
.attr
,
643 &iio_dev_attr_bvrms
.dev_attr
.attr
,
644 &iio_dev_attr_cvrms
.dev_attr
.attr
,
645 &iio_dev_attr_aigain
.dev_attr
.attr
,
646 &iio_dev_attr_bigain
.dev_attr
.attr
,
647 &iio_dev_attr_cigain
.dev_attr
.attr
,
648 &iio_dev_attr_avrmsgain
.dev_attr
.attr
,
649 &iio_dev_attr_bvrmsgain
.dev_attr
.attr
,
650 &iio_dev_attr_cvrmsgain
.dev_attr
.attr
,
651 &iio_dev_attr_airmsos
.dev_attr
.attr
,
652 &iio_dev_attr_birmsos
.dev_attr
.attr
,
653 &iio_dev_attr_cirmsos
.dev_attr
.attr
,
654 &iio_dev_attr_avrmsos
.dev_attr
.attr
,
655 &iio_dev_attr_bvrmsos
.dev_attr
.attr
,
656 &iio_dev_attr_cvrmsos
.dev_attr
.attr
,
660 static const struct attribute_group ade7758_attribute_group
= {
661 .attrs
= ade7758_attributes
,
664 static struct iio_chan_spec ade7758_channels
[] = {
669 .extend_name
= "raw",
670 .info_mask
= IIO_CHAN_INFO_RAW_SEPARATE_BIT
|
671 IIO_CHAN_INFO_SCALE_SHARED_BIT
,
672 .address
= AD7758_WT(AD7758_PHASE_A
, AD7758_VOLTAGE
),
683 .extend_name
= "raw",
684 .info_mask
= IIO_CHAN_INFO_RAW_SEPARATE_BIT
|
685 IIO_CHAN_INFO_SCALE_SHARED_BIT
,
686 .address
= AD7758_WT(AD7758_PHASE_A
, AD7758_CURRENT
),
697 .extend_name
= "apparent_raw",
698 .info_mask
= IIO_CHAN_INFO_RAW_SEPARATE_BIT
|
699 IIO_CHAN_INFO_SCALE_SHARED_BIT
,
700 .address
= AD7758_WT(AD7758_PHASE_A
, AD7758_APP_PWR
),
711 .extend_name
= "active_raw",
712 .info_mask
= IIO_CHAN_INFO_RAW_SEPARATE_BIT
|
713 IIO_CHAN_INFO_SCALE_SHARED_BIT
,
714 .address
= AD7758_WT(AD7758_PHASE_A
, AD7758_ACT_PWR
),
725 .extend_name
= "reactive_raw",
726 .info_mask
= IIO_CHAN_INFO_RAW_SEPARATE_BIT
|
727 IIO_CHAN_INFO_SCALE_SHARED_BIT
,
728 .address
= AD7758_WT(AD7758_PHASE_A
, AD7758_REACT_PWR
),
739 .extend_name
= "raw",
740 .info_mask
= IIO_CHAN_INFO_RAW_SEPARATE_BIT
|
741 IIO_CHAN_INFO_SCALE_SHARED_BIT
,
742 .address
= AD7758_WT(AD7758_PHASE_B
, AD7758_VOLTAGE
),
753 .extend_name
= "raw",
754 .info_mask
= IIO_CHAN_INFO_RAW_SEPARATE_BIT
|
755 IIO_CHAN_INFO_SCALE_SHARED_BIT
,
756 .address
= AD7758_WT(AD7758_PHASE_B
, AD7758_CURRENT
),
767 .extend_name
= "apparent_raw",
768 .info_mask
= IIO_CHAN_INFO_RAW_SEPARATE_BIT
|
769 IIO_CHAN_INFO_SCALE_SHARED_BIT
,
770 .address
= AD7758_WT(AD7758_PHASE_B
, AD7758_APP_PWR
),
781 .extend_name
= "active_raw",
782 .info_mask
= IIO_CHAN_INFO_RAW_SEPARATE_BIT
|
783 IIO_CHAN_INFO_SCALE_SHARED_BIT
,
784 .address
= AD7758_WT(AD7758_PHASE_B
, AD7758_ACT_PWR
),
795 .extend_name
= "reactive_raw",
796 .info_mask
= IIO_CHAN_INFO_RAW_SEPARATE_BIT
|
797 IIO_CHAN_INFO_SCALE_SHARED_BIT
,
798 .address
= AD7758_WT(AD7758_PHASE_B
, AD7758_REACT_PWR
),
809 .extend_name
= "raw",
810 .info_mask
= IIO_CHAN_INFO_RAW_SEPARATE_BIT
|
811 IIO_CHAN_INFO_SCALE_SHARED_BIT
,
812 .address
= AD7758_WT(AD7758_PHASE_C
, AD7758_VOLTAGE
),
823 .extend_name
= "raw",
824 .info_mask
= IIO_CHAN_INFO_RAW_SEPARATE_BIT
|
825 IIO_CHAN_INFO_SCALE_SHARED_BIT
,
826 .address
= AD7758_WT(AD7758_PHASE_C
, AD7758_CURRENT
),
837 .extend_name
= "apparent_raw",
838 .info_mask
= IIO_CHAN_INFO_RAW_SEPARATE_BIT
|
839 IIO_CHAN_INFO_SCALE_SHARED_BIT
,
840 .address
= AD7758_WT(AD7758_PHASE_C
, AD7758_APP_PWR
),
851 .extend_name
= "active_raw",
852 .info_mask
= IIO_CHAN_INFO_RAW_SEPARATE_BIT
|
853 IIO_CHAN_INFO_SCALE_SHARED_BIT
,
854 .address
= AD7758_WT(AD7758_PHASE_C
, AD7758_ACT_PWR
),
865 .extend_name
= "reactive_raw",
866 .info_mask
= IIO_CHAN_INFO_RAW_SEPARATE_BIT
|
867 IIO_CHAN_INFO_SCALE_SHARED_BIT
,
868 .address
= AD7758_WT(AD7758_PHASE_C
, AD7758_REACT_PWR
),
876 IIO_CHAN_SOFT_TIMESTAMP(15),
879 static const struct iio_info ade7758_info
= {
880 .attrs
= &ade7758_attribute_group
,
881 .driver_module
= THIS_MODULE
,
884 static int __devinit
ade7758_probe(struct spi_device
*spi
)
887 struct ade7758_state
*st
;
888 struct iio_dev
*indio_dev
= iio_device_alloc(sizeof(*st
));
890 if (indio_dev
== NULL
) {
895 st
= iio_priv(indio_dev
);
896 /* this is only used for removal purposes */
897 spi_set_drvdata(spi
, indio_dev
);
899 /* Allocate the comms buffers */
900 st
->rx
= kcalloc(ADE7758_MAX_RX
, sizeof(*st
->rx
), GFP_KERNEL
);
901 if (st
->rx
== NULL
) {
905 st
->tx
= kcalloc(ADE7758_MAX_TX
, sizeof(*st
->tx
), GFP_KERNEL
);
906 if (st
->tx
== NULL
) {
911 st
->ade7758_ring_channels
= &ade7758_channels
[0];
912 mutex_init(&st
->buf_lock
);
914 indio_dev
->name
= spi
->dev
.driver
->name
;
915 indio_dev
->dev
.parent
= &spi
->dev
;
916 indio_dev
->info
= &ade7758_info
;
917 indio_dev
->modes
= INDIO_DIRECT_MODE
;
919 ret
= ade7758_configure_ring(indio_dev
);
923 ret
= iio_buffer_register(indio_dev
,
924 &ade7758_channels
[0],
925 ARRAY_SIZE(ade7758_channels
));
927 dev_err(&spi
->dev
, "failed to initialize the ring\n");
928 goto error_unreg_ring_funcs
;
931 /* Get the device into a sane initial state */
932 ret
= ade7758_initial_setup(indio_dev
);
934 goto error_uninitialize_ring
;
937 ret
= ade7758_probe_trigger(indio_dev
);
939 goto error_uninitialize_ring
;
942 ret
= iio_device_register(indio_dev
);
944 goto error_remove_trigger
;
948 error_remove_trigger
:
950 ade7758_remove_trigger(indio_dev
);
951 error_uninitialize_ring
:
952 ade7758_uninitialize_ring(indio_dev
);
953 error_unreg_ring_funcs
:
954 ade7758_unconfigure_ring(indio_dev
);
960 iio_device_free(indio_dev
);
965 static int ade7758_remove(struct spi_device
*spi
)
967 struct iio_dev
*indio_dev
= spi_get_drvdata(spi
);
968 struct ade7758_state
*st
= iio_priv(indio_dev
);
971 iio_device_unregister(indio_dev
);
972 ret
= ade7758_stop_device(&indio_dev
->dev
);
976 ade7758_remove_trigger(indio_dev
);
977 ade7758_uninitialize_ring(indio_dev
);
978 ade7758_unconfigure_ring(indio_dev
);
982 iio_device_free(indio_dev
);
988 static const struct spi_device_id ade7758_id
[] = {
992 MODULE_DEVICE_TABLE(spi
, ade7758_id
);
994 static struct spi_driver ade7758_driver
= {
997 .owner
= THIS_MODULE
,
999 .probe
= ade7758_probe
,
1000 .remove
= __devexit_p(ade7758_remove
),
1001 .id_table
= ade7758_id
,
1003 module_spi_driver(ade7758_driver
);
1005 MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>");
1006 MODULE_DESCRIPTION("Analog Devices ADE7758 Polyphase Multifunction Energy Metering IC Driver");
1007 MODULE_LICENSE("GPL v2");