diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-04-30 08:01:04 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-04-30 08:01:04 -0400 |
commit | df90e2258950fd631cdbf322c1ee1f22068391aa (patch) | |
tree | 0b6dd2717c04bb7f93db6abdeda208aeea4cd74e /drivers/media/common | |
parent | aad797c89903d570c17f6affc770eb98afd74e62 (diff) | |
parent | 02615ed5e1b2283db2495af3cf8f4ee172c77d80 (diff) |
Merge branch 'devel-for-v3.10' into v4l_for_linus
* patchwork: (831 commits)
[media] cx88: make core less verbose
[media] em28xx: fix oops at em28xx_dvb_bus_ctrl()
[media] s5c73m3: fix indentation of the help section in Kconfig
[media] cx25821-alsa: get rid of a __must_check warning
[media] cx25821-video: declare cx25821_vidioc_s_std as static
[media] cx25821-video: remove maxw from cx25821_vidioc_try_fmt_vid_cap
[media] r820t: Remove a warning for an unused value
[media] dib0090: Fix a warning at dib0090_set_EFUSE
[media] dib8000: fix a warning
[media] dib8000: Fix sub-channel range
[media] dib8000: store dtv_property_cache in a temp var
[media] dib8000: warning fix: declare internal functions as static
[media] r820t: quiet gcc warning on n_ring
[media] r820t: memory leak in release()
[media] r820t: precendence bug in r820t_xtal_check()
[media] videodev2.h: Remove the unused old V4L1 buffer types
[media] anysee: Grammar s/report the/report to/
[media] anysee: Initialize ret = 0 in anysee_frontend_attach()
[media] media: videobuf2: fix the length check for mmap
[media] em28xx: save isoc endpoint number for DVB only if endpoint has alt settings with xMaxPacketSize != 0
...
Conflicts:
drivers/media/pci/cx25821/cx25821-video.c
drivers/media/platform/Kconfig
Diffstat (limited to 'drivers/media/common')
-rw-r--r-- | drivers/media/common/Kconfig | 4 | ||||
-rw-r--r-- | drivers/media/common/Makefile | 1 | ||||
-rw-r--r-- | drivers/media/common/b2c2/flexcop-fe-tuner.c | 4 | ||||
-rw-r--r-- | drivers/media/common/cypress_firmware.c | 132 | ||||
-rw-r--r-- | drivers/media/common/cypress_firmware.h | 28 | ||||
-rw-r--r-- | drivers/media/common/saa7146/saa7146_video.c | 4 | ||||
-rw-r--r-- | drivers/media/common/siano/Kconfig | 12 | ||||
-rw-r--r-- | drivers/media/common/siano/Makefile | 5 | ||||
-rw-r--r-- | drivers/media/common/siano/sms-cards.c | 115 | ||||
-rw-r--r-- | drivers/media/common/siano/sms-cards.h | 14 | ||||
-rw-r--r-- | drivers/media/common/siano/smscoreapi.c | 1298 | ||||
-rw-r--r-- | drivers/media/common/siano/smscoreapi.h | 1007 | ||||
-rw-r--r-- | drivers/media/common/siano/smsdvb-debugfs.c | 551 | ||||
-rw-r--r-- | drivers/media/common/siano/smsdvb-main.c | 1230 | ||||
-rw-r--r-- | drivers/media/common/siano/smsdvb.c | 1078 | ||||
-rw-r--r-- | drivers/media/common/siano/smsdvb.h | 130 | ||||
-rw-r--r-- | drivers/media/common/siano/smsendian.c | 44 | ||||
-rw-r--r-- | drivers/media/common/siano/smsir.h | 1 |
18 files changed, 3856 insertions, 1802 deletions
diff --git a/drivers/media/common/Kconfig b/drivers/media/common/Kconfig index 56c25e6299e9..b85f88c8ddbd 100644 --- a/drivers/media/common/Kconfig +++ b/drivers/media/common/Kconfig | |||
@@ -16,6 +16,10 @@ config VIDEO_TVEEPROM | |||
16 | tristate | 16 | tristate |
17 | depends on I2C | 17 | depends on I2C |
18 | 18 | ||
19 | config CYPRESS_FIRMWARE | ||
20 | tristate "Cypress firmware helper routines" | ||
21 | depends on USB | ||
22 | |||
19 | source "drivers/media/common/b2c2/Kconfig" | 23 | source "drivers/media/common/b2c2/Kconfig" |
20 | source "drivers/media/common/saa7146/Kconfig" | 24 | source "drivers/media/common/saa7146/Kconfig" |
21 | source "drivers/media/common/siano/Kconfig" | 25 | source "drivers/media/common/siano/Kconfig" |
diff --git a/drivers/media/common/Makefile b/drivers/media/common/Makefile index 8f8d18755d15..d208de3b7cc0 100644 --- a/drivers/media/common/Makefile +++ b/drivers/media/common/Makefile | |||
@@ -2,3 +2,4 @@ obj-y += b2c2/ saa7146/ siano/ | |||
2 | obj-$(CONFIG_VIDEO_CX2341X) += cx2341x.o | 2 | obj-$(CONFIG_VIDEO_CX2341X) += cx2341x.o |
3 | obj-$(CONFIG_VIDEO_BTCX) += btcx-risc.o | 3 | obj-$(CONFIG_VIDEO_BTCX) += btcx-risc.o |
4 | obj-$(CONFIG_VIDEO_TVEEPROM) += tveeprom.o | 4 | obj-$(CONFIG_VIDEO_TVEEPROM) += tveeprom.o |
5 | obj-$(CONFIG_CYPRESS_FIRMWARE) += cypress_firmware.o | ||
diff --git a/drivers/media/common/b2c2/flexcop-fe-tuner.c b/drivers/media/common/b2c2/flexcop-fe-tuner.c index 850a6c606750..7e14e90d2922 100644 --- a/drivers/media/common/b2c2/flexcop-fe-tuner.c +++ b/drivers/media/common/b2c2/flexcop-fe-tuner.c | |||
@@ -325,7 +325,7 @@ static int skystar2_rev27_attach(struct flexcop_device *fc, | |||
325 | /* enable no_base_addr - no repeated start when reading */ | 325 | /* enable no_base_addr - no repeated start when reading */ |
326 | fc->fc_i2c_adap[2].no_base_addr = 1; | 326 | fc->fc_i2c_adap[2].no_base_addr = 1; |
327 | if (!dvb_attach(isl6421_attach, fc->fe, &fc->fc_i2c_adap[2].i2c_adap, | 327 | if (!dvb_attach(isl6421_attach, fc->fe, &fc->fc_i2c_adap[2].i2c_adap, |
328 | 0x08, 1, 1)) { | 328 | 0x08, 1, 1, false)) { |
329 | err("ISL6421 could NOT be attached"); | 329 | err("ISL6421 could NOT be attached"); |
330 | goto fail_isl; | 330 | goto fail_isl; |
331 | } | 331 | } |
@@ -391,7 +391,7 @@ static int skystar2_rev28_attach(struct flexcop_device *fc, | |||
391 | 391 | ||
392 | fc->fc_i2c_adap[2].no_base_addr = 1; | 392 | fc->fc_i2c_adap[2].no_base_addr = 1; |
393 | if (!dvb_attach(isl6421_attach, fc->fe, &fc->fc_i2c_adap[2].i2c_adap, | 393 | if (!dvb_attach(isl6421_attach, fc->fe, &fc->fc_i2c_adap[2].i2c_adap, |
394 | 0x08, 0, 0)) { | 394 | 0x08, 0, 0, false)) { |
395 | err("ISL6421 could NOT be attached"); | 395 | err("ISL6421 could NOT be attached"); |
396 | fc->fc_i2c_adap[2].no_base_addr = 0; | 396 | fc->fc_i2c_adap[2].no_base_addr = 0; |
397 | return 0; | 397 | return 0; |
diff --git a/drivers/media/common/cypress_firmware.c b/drivers/media/common/cypress_firmware.c new file mode 100644 index 000000000000..577e82058fdc --- /dev/null +++ b/drivers/media/common/cypress_firmware.c | |||
@@ -0,0 +1,132 @@ | |||
1 | /* cypress_firmware.c is part of the DVB USB library. | ||
2 | * | ||
3 | * Copyright (C) 2004-6 Patrick Boettcher (patrick.boettcher@desy.de) | ||
4 | * see dvb-usb-init.c for copyright information. | ||
5 | * | ||
6 | * This file contains functions for downloading the firmware to Cypress FX 1 | ||
7 | * and 2 based devices. | ||
8 | * | ||
9 | */ | ||
10 | |||
11 | #include <linux/module.h> | ||
12 | #include <linux/slab.h> | ||
13 | #include <linux/usb.h> | ||
14 | #include <linux/firmware.h> | ||
15 | #include "cypress_firmware.h" | ||
16 | |||
17 | struct usb_cypress_controller { | ||
18 | u8 id; | ||
19 | const char *name; /* name of the usb controller */ | ||
20 | u16 cs_reg; /* needs to be restarted, | ||
21 | * when the firmware has been downloaded */ | ||
22 | }; | ||
23 | |||
24 | static const struct usb_cypress_controller cypress[] = { | ||
25 | { .id = CYPRESS_AN2135, .name = "Cypress AN2135", .cs_reg = 0x7f92 }, | ||
26 | { .id = CYPRESS_AN2235, .name = "Cypress AN2235", .cs_reg = 0x7f92 }, | ||
27 | { .id = CYPRESS_FX2, .name = "Cypress FX2", .cs_reg = 0xe600 }, | ||
28 | }; | ||
29 | |||
30 | /* | ||
31 | * load a firmware packet to the device | ||
32 | */ | ||
33 | static int usb_cypress_writemem(struct usb_device *udev, u16 addr, u8 *data, | ||
34 | u8 len) | ||
35 | { | ||
36 | return usb_control_msg(udev, usb_sndctrlpipe(udev, 0), | ||
37 | 0xa0, USB_TYPE_VENDOR, addr, 0x00, data, len, 5000); | ||
38 | } | ||
39 | |||
40 | static int cypress_get_hexline(const struct firmware *fw, | ||
41 | struct hexline *hx, int *pos) | ||
42 | { | ||
43 | u8 *b = (u8 *) &fw->data[*pos]; | ||
44 | int data_offs = 4; | ||
45 | |||
46 | if (*pos >= fw->size) | ||
47 | return 0; | ||
48 | |||
49 | memset(hx, 0, sizeof(struct hexline)); | ||
50 | hx->len = b[0]; | ||
51 | |||
52 | if ((*pos + hx->len + 4) >= fw->size) | ||
53 | return -EINVAL; | ||
54 | |||
55 | hx->addr = b[1] | (b[2] << 8); | ||
56 | hx->type = b[3]; | ||
57 | |||
58 | if (hx->type == 0x04) { | ||
59 | /* b[4] and b[5] are the Extended linear address record data | ||
60 | * field */ | ||
61 | hx->addr |= (b[4] << 24) | (b[5] << 16); | ||
62 | } | ||
63 | |||
64 | memcpy(hx->data, &b[data_offs], hx->len); | ||
65 | hx->chk = b[hx->len + data_offs]; | ||
66 | *pos += hx->len + 5; | ||
67 | |||
68 | return *pos; | ||
69 | } | ||
70 | |||
71 | int cypress_load_firmware(struct usb_device *udev, | ||
72 | const struct firmware *fw, int type) | ||
73 | { | ||
74 | struct hexline *hx; | ||
75 | int ret, pos = 0; | ||
76 | |||
77 | hx = kmalloc(sizeof(struct hexline), GFP_KERNEL); | ||
78 | if (!hx) { | ||
79 | dev_err(&udev->dev, "%s: kmalloc() failed\n", KBUILD_MODNAME); | ||
80 | return -ENOMEM; | ||
81 | } | ||
82 | |||
83 | /* stop the CPU */ | ||
84 | hx->data[0] = 1; | ||
85 | ret = usb_cypress_writemem(udev, cypress[type].cs_reg, hx->data, 1); | ||
86 | if (ret != 1) { | ||
87 | dev_err(&udev->dev, "%s: CPU stop failed=%d\n", | ||
88 | KBUILD_MODNAME, ret); | ||
89 | ret = -EIO; | ||
90 | goto err_kfree; | ||
91 | } | ||
92 | |||
93 | /* write firmware to memory */ | ||
94 | for (;;) { | ||
95 | ret = cypress_get_hexline(fw, hx, &pos); | ||
96 | if (ret < 0) | ||
97 | goto err_kfree; | ||
98 | else if (ret == 0) | ||
99 | break; | ||
100 | |||
101 | ret = usb_cypress_writemem(udev, hx->addr, hx->data, hx->len); | ||
102 | if (ret < 0) { | ||
103 | goto err_kfree; | ||
104 | } else if (ret != hx->len) { | ||
105 | dev_err(&udev->dev, | ||
106 | "%s: error while transferring firmware (transferred size=%d, block size=%d)\n", | ||
107 | KBUILD_MODNAME, ret, hx->len); | ||
108 | ret = -EIO; | ||
109 | goto err_kfree; | ||
110 | } | ||
111 | } | ||
112 | |||
113 | /* start the CPU */ | ||
114 | hx->data[0] = 0; | ||
115 | ret = usb_cypress_writemem(udev, cypress[type].cs_reg, hx->data, 1); | ||
116 | if (ret != 1) { | ||
117 | dev_err(&udev->dev, "%s: CPU start failed=%d\n", | ||
118 | KBUILD_MODNAME, ret); | ||
119 | ret = -EIO; | ||
120 | goto err_kfree; | ||
121 | } | ||
122 | |||
123 | ret = 0; | ||
124 | err_kfree: | ||
125 | kfree(hx); | ||
126 | return ret; | ||
127 | } | ||
128 | EXPORT_SYMBOL(cypress_load_firmware); | ||
129 | |||
130 | MODULE_AUTHOR("Antti Palosaari <crope@iki.fi>"); | ||
131 | MODULE_DESCRIPTION("Cypress firmware download"); | ||
132 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/media/common/cypress_firmware.h b/drivers/media/common/cypress_firmware.h new file mode 100644 index 000000000000..e493cbc7a528 --- /dev/null +++ b/drivers/media/common/cypress_firmware.h | |||
@@ -0,0 +1,28 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004-6 Patrick Boettcher (patrick.boettcher@desy.de) | ||
3 | * see dvb-usb-init.c for copyright information. | ||
4 | * | ||
5 | * This file contains functions for downloading the firmware to Cypress FX 1 | ||
6 | * and 2 based devices. | ||
7 | * | ||
8 | */ | ||
9 | |||
10 | #ifndef CYPRESS_FIRMWARE_H | ||
11 | #define CYPRESS_FIRMWARE_H | ||
12 | |||
13 | #define CYPRESS_AN2135 0 | ||
14 | #define CYPRESS_AN2235 1 | ||
15 | #define CYPRESS_FX2 2 | ||
16 | |||
17 | /* commonly used firmware download types and function */ | ||
18 | struct hexline { | ||
19 | u8 len; | ||
20 | u32 addr; | ||
21 | u8 type; | ||
22 | u8 data[255]; | ||
23 | u8 chk; | ||
24 | }; | ||
25 | |||
26 | int cypress_load_firmware(struct usb_device *, const struct firmware *, int); | ||
27 | |||
28 | #endif | ||
diff --git a/drivers/media/common/saa7146/saa7146_video.c b/drivers/media/common/saa7146/saa7146_video.c index 4143d61f79b1..fe907f2e8f59 100644 --- a/drivers/media/common/saa7146/saa7146_video.c +++ b/drivers/media/common/saa7146/saa7146_video.c | |||
@@ -832,7 +832,7 @@ static int vidioc_g_std(struct file *file, void *fh, v4l2_std_id *norm) | |||
832 | } | 832 | } |
833 | */ | 833 | */ |
834 | 834 | ||
835 | static int vidioc_s_std(struct file *file, void *fh, v4l2_std_id *id) | 835 | static int vidioc_s_std(struct file *file, void *fh, v4l2_std_id id) |
836 | { | 836 | { |
837 | struct saa7146_dev *dev = ((struct saa7146_fh *)fh)->dev; | 837 | struct saa7146_dev *dev = ((struct saa7146_fh *)fh)->dev; |
838 | struct saa7146_vv *vv = dev->vv_data; | 838 | struct saa7146_vv *vv = dev->vv_data; |
@@ -856,7 +856,7 @@ static int vidioc_s_std(struct file *file, void *fh, v4l2_std_id *id) | |||
856 | } | 856 | } |
857 | 857 | ||
858 | for (i = 0; i < dev->ext_vv_data->num_stds; i++) | 858 | for (i = 0; i < dev->ext_vv_data->num_stds; i++) |
859 | if (*id & dev->ext_vv_data->stds[i].id) | 859 | if (id & dev->ext_vv_data->stds[i].id) |
860 | break; | 860 | break; |
861 | if (i != dev->ext_vv_data->num_stds) { | 861 | if (i != dev->ext_vv_data->num_stds) { |
862 | vv->standard = &dev->ext_vv_data->stds[i]; | 862 | vv->standard = &dev->ext_vv_data->stds[i]; |
diff --git a/drivers/media/common/siano/Kconfig b/drivers/media/common/siano/Kconfig index 68f0f604678e..f3f5ec44e685 100644 --- a/drivers/media/common/siano/Kconfig +++ b/drivers/media/common/siano/Kconfig | |||
@@ -17,3 +17,15 @@ config SMS_SIANO_RC | |||
17 | default y | 17 | default y |
18 | ---help--- | 18 | ---help--- |
19 | Choose Y to select Remote Controller support for Siano driver. | 19 | Choose Y to select Remote Controller support for Siano driver. |
20 | |||
21 | config SMS_SIANO_DEBUGFS | ||
22 | bool "Enable debugfs for smsdvb" | ||
23 | depends on SMS_SIANO_MDTV | ||
24 | depends on DEBUG_FS | ||
25 | depends on SMS_USB_DRV | ||
26 | ---help--- | ||
27 | Choose Y to enable visualizing a dump of the frontend | ||
28 | statistics response packets via debugfs. Currently, works | ||
29 | only with Siano USB devices. | ||
30 | |||
31 | Useful only for developers. In doubt, say N. | ||
diff --git a/drivers/media/common/siano/Makefile b/drivers/media/common/siano/Makefile index 81b1e985bea5..4c0567f106b2 100644 --- a/drivers/media/common/siano/Makefile +++ b/drivers/media/common/siano/Makefile | |||
@@ -1,4 +1,5 @@ | |||
1 | smsmdtv-objs := smscoreapi.o sms-cards.o smsendian.o | 1 | smsmdtv-objs := smscoreapi.o sms-cards.o smsendian.o |
2 | smsdvb-objs := smsdvb-main.o | ||
2 | 3 | ||
3 | obj-$(CONFIG_SMS_SIANO_MDTV) += smsmdtv.o smsdvb.o | 4 | obj-$(CONFIG_SMS_SIANO_MDTV) += smsmdtv.o smsdvb.o |
4 | 5 | ||
@@ -6,6 +7,10 @@ ifeq ($(CONFIG_SMS_SIANO_RC),y) | |||
6 | smsmdtv-objs += smsir.o | 7 | smsmdtv-objs += smsir.o |
7 | endif | 8 | endif |
8 | 9 | ||
10 | ifeq ($(CONFIG_SMS_SIANO_DEBUGFS),y) | ||
11 | smsdvb-objs += smsdvb-debugfs.o | ||
12 | endif | ||
13 | |||
9 | ccflags-y += -Idrivers/media/dvb-core | 14 | ccflags-y += -Idrivers/media/dvb-core |
10 | ccflags-y += $(extra-cflags-y) $(extra-cflags-m) | 15 | ccflags-y += $(extra-cflags-y) $(extra-cflags-m) |
11 | 16 | ||
diff --git a/drivers/media/common/siano/sms-cards.c b/drivers/media/common/siano/sms-cards.c index 680c781c8dd6..82769993eeb7 100644 --- a/drivers/media/common/siano/sms-cards.c +++ b/drivers/media/common/siano/sms-cards.c | |||
@@ -28,43 +28,53 @@ MODULE_PARM_DESC(cards_dbg, "set debug level (info=1, adv=2 (or-able))"); | |||
28 | static struct sms_board sms_boards[] = { | 28 | static struct sms_board sms_boards[] = { |
29 | [SMS_BOARD_UNKNOWN] = { | 29 | [SMS_BOARD_UNKNOWN] = { |
30 | .name = "Unknown board", | 30 | .name = "Unknown board", |
31 | .type = SMS_UNKNOWN_TYPE, | ||
32 | .default_mode = DEVICE_MODE_NONE, | ||
31 | }, | 33 | }, |
32 | [SMS1XXX_BOARD_SIANO_STELLAR] = { | 34 | [SMS1XXX_BOARD_SIANO_STELLAR] = { |
33 | .name = "Siano Stellar Digital Receiver", | 35 | .name = "Siano Stellar Digital Receiver", |
34 | .type = SMS_STELLAR, | 36 | .type = SMS_STELLAR, |
37 | .default_mode = DEVICE_MODE_DVBT_BDA, | ||
35 | }, | 38 | }, |
36 | [SMS1XXX_BOARD_SIANO_NOVA_A] = { | 39 | [SMS1XXX_BOARD_SIANO_NOVA_A] = { |
37 | .name = "Siano Nova A Digital Receiver", | 40 | .name = "Siano Nova A Digital Receiver", |
38 | .type = SMS_NOVA_A0, | 41 | .type = SMS_NOVA_A0, |
42 | .default_mode = DEVICE_MODE_DVBT_BDA, | ||
39 | }, | 43 | }, |
40 | [SMS1XXX_BOARD_SIANO_NOVA_B] = { | 44 | [SMS1XXX_BOARD_SIANO_NOVA_B] = { |
41 | .name = "Siano Nova B Digital Receiver", | 45 | .name = "Siano Nova B Digital Receiver", |
42 | .type = SMS_NOVA_B0, | 46 | .type = SMS_NOVA_B0, |
47 | .default_mode = DEVICE_MODE_DVBT_BDA, | ||
43 | }, | 48 | }, |
44 | [SMS1XXX_BOARD_SIANO_VEGA] = { | 49 | [SMS1XXX_BOARD_SIANO_VEGA] = { |
45 | .name = "Siano Vega Digital Receiver", | 50 | .name = "Siano Vega Digital Receiver", |
46 | .type = SMS_VEGA, | 51 | .type = SMS_VEGA, |
52 | .default_mode = DEVICE_MODE_CMMB, | ||
47 | }, | 53 | }, |
48 | [SMS1XXX_BOARD_HAUPPAUGE_CATAMOUNT] = { | 54 | [SMS1XXX_BOARD_HAUPPAUGE_CATAMOUNT] = { |
49 | .name = "Hauppauge Catamount", | 55 | .name = "Hauppauge Catamount", |
50 | .type = SMS_STELLAR, | 56 | .type = SMS_STELLAR, |
51 | .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-stellar-dvbt-01.fw", | 57 | .fw[DEVICE_MODE_DVBT_BDA] = SMS_FW_DVBT_STELLAR, |
58 | .default_mode = DEVICE_MODE_DVBT_BDA, | ||
52 | }, | 59 | }, |
53 | [SMS1XXX_BOARD_HAUPPAUGE_OKEMO_A] = { | 60 | [SMS1XXX_BOARD_HAUPPAUGE_OKEMO_A] = { |
54 | .name = "Hauppauge Okemo-A", | 61 | .name = "Hauppauge Okemo-A", |
55 | .type = SMS_NOVA_A0, | 62 | .type = SMS_NOVA_A0, |
56 | .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-nova-a-dvbt-01.fw", | 63 | .fw[DEVICE_MODE_DVBT_BDA] = SMS_FW_DVBT_NOVA_A, |
64 | .default_mode = DEVICE_MODE_DVBT_BDA, | ||
57 | }, | 65 | }, |
58 | [SMS1XXX_BOARD_HAUPPAUGE_OKEMO_B] = { | 66 | [SMS1XXX_BOARD_HAUPPAUGE_OKEMO_B] = { |
59 | .name = "Hauppauge Okemo-B", | 67 | .name = "Hauppauge Okemo-B", |
60 | .type = SMS_NOVA_B0, | 68 | .type = SMS_NOVA_B0, |
61 | .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-nova-b-dvbt-01.fw", | 69 | .fw[DEVICE_MODE_DVBT_BDA] = SMS_FW_DVBT_NOVA_B, |
70 | .default_mode = DEVICE_MODE_DVBT_BDA, | ||
62 | }, | 71 | }, |
63 | [SMS1XXX_BOARD_HAUPPAUGE_WINDHAM] = { | 72 | [SMS1XXX_BOARD_HAUPPAUGE_WINDHAM] = { |
64 | .name = "Hauppauge WinTV MiniStick", | 73 | .name = "Hauppauge WinTV MiniStick", |
65 | .type = SMS_NOVA_B0, | 74 | .type = SMS_NOVA_B0, |
66 | .fw[DEVICE_MODE_ISDBT_BDA] = "sms1xxx-hcw-55xxx-isdbt-02.fw", | 75 | .fw[DEVICE_MODE_ISDBT_BDA] = SMS_FW_ISDBT_HCW_55XXX, |
67 | .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-hcw-55xxx-dvbt-02.fw", | 76 | .fw[DEVICE_MODE_DVBT_BDA] = SMS_FW_DVBT_HCW_55XXX, |
77 | .default_mode = DEVICE_MODE_DVBT_BDA, | ||
68 | .rc_codes = RC_MAP_HAUPPAUGE, | 78 | .rc_codes = RC_MAP_HAUPPAUGE, |
69 | .board_cfg.leds_power = 26, | 79 | .board_cfg.leds_power = 26, |
70 | .board_cfg.led0 = 27, | 80 | .board_cfg.led0 = 27, |
@@ -77,7 +87,8 @@ static struct sms_board sms_boards[] = { | |||
77 | [SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD] = { | 87 | [SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD] = { |
78 | .name = "Hauppauge WinTV MiniCard", | 88 | .name = "Hauppauge WinTV MiniCard", |
79 | .type = SMS_NOVA_B0, | 89 | .type = SMS_NOVA_B0, |
80 | .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-hcw-55xxx-dvbt-02.fw", | 90 | .fw[DEVICE_MODE_DVBT_BDA] = SMS_FW_DVBT_HCW_55XXX, |
91 | .default_mode = DEVICE_MODE_DVBT_BDA, | ||
81 | .lna_ctrl = 29, | 92 | .lna_ctrl = 29, |
82 | .board_cfg.foreign_lna0_ctrl = 29, | 93 | .board_cfg.foreign_lna0_ctrl = 29, |
83 | .rf_switch = 17, | 94 | .rf_switch = 17, |
@@ -86,18 +97,65 @@ static struct sms_board sms_boards[] = { | |||
86 | [SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD_R2] = { | 97 | [SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD_R2] = { |
87 | .name = "Hauppauge WinTV MiniCard", | 98 | .name = "Hauppauge WinTV MiniCard", |
88 | .type = SMS_NOVA_B0, | 99 | .type = SMS_NOVA_B0, |
89 | .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-hcw-55xxx-dvbt-02.fw", | 100 | .fw[DEVICE_MODE_DVBT_BDA] = SMS_FW_DVBT_HCW_55XXX, |
101 | .default_mode = DEVICE_MODE_DVBT_BDA, | ||
90 | .lna_ctrl = -1, | 102 | .lna_ctrl = -1, |
91 | }, | 103 | }, |
92 | [SMS1XXX_BOARD_SIANO_NICE] = { | 104 | [SMS1XXX_BOARD_SIANO_NICE] = { |
93 | /* 11 */ | ||
94 | .name = "Siano Nice Digital Receiver", | 105 | .name = "Siano Nice Digital Receiver", |
95 | .type = SMS_NOVA_B0, | 106 | .type = SMS_NOVA_B0, |
107 | .default_mode = DEVICE_MODE_DVBT_BDA, | ||
96 | }, | 108 | }, |
97 | [SMS1XXX_BOARD_SIANO_VENICE] = { | 109 | [SMS1XXX_BOARD_SIANO_VENICE] = { |
98 | /* 12 */ | ||
99 | .name = "Siano Venice Digital Receiver", | 110 | .name = "Siano Venice Digital Receiver", |
100 | .type = SMS_VEGA, | 111 | .type = SMS_VEGA, |
112 | .default_mode = DEVICE_MODE_CMMB, | ||
113 | }, | ||
114 | [SMS1XXX_BOARD_SIANO_STELLAR_ROM] = { | ||
115 | .name = "Siano Stellar Digital Receiver ROM", | ||
116 | .type = SMS_STELLAR, | ||
117 | .default_mode = DEVICE_MODE_DVBT_BDA, | ||
118 | .intf_num = 1, | ||
119 | }, | ||
120 | [SMS1XXX_BOARD_ZTE_DVB_DATA_CARD] = { | ||
121 | .name = "ZTE Data Card Digital Receiver", | ||
122 | .type = SMS_NOVA_B0, | ||
123 | .default_mode = DEVICE_MODE_DVBT_BDA, | ||
124 | .intf_num = 5, | ||
125 | .mtu = 15792, | ||
126 | }, | ||
127 | [SMS1XXX_BOARD_ONDA_MDTV_DATA_CARD] = { | ||
128 | .name = "ONDA Data Card Digital Receiver", | ||
129 | .type = SMS_NOVA_B0, | ||
130 | .default_mode = DEVICE_MODE_DVBT_BDA, | ||
131 | .intf_num = 6, | ||
132 | .mtu = 15792, | ||
133 | }, | ||
134 | [SMS1XXX_BOARD_SIANO_MING] = { | ||
135 | .name = "Siano Ming Digital Receiver", | ||
136 | .type = SMS_MING, | ||
137 | .default_mode = DEVICE_MODE_CMMB, | ||
138 | }, | ||
139 | [SMS1XXX_BOARD_SIANO_PELE] = { | ||
140 | .name = "Siano Pele Digital Receiver", | ||
141 | .type = SMS_PELE, | ||
142 | .default_mode = DEVICE_MODE_ISDBT_BDA, | ||
143 | }, | ||
144 | [SMS1XXX_BOARD_SIANO_RIO] = { | ||
145 | .name = "Siano Rio Digital Receiver", | ||
146 | .type = SMS_RIO, | ||
147 | .default_mode = DEVICE_MODE_ISDBT_BDA, | ||
148 | }, | ||
149 | [SMS1XXX_BOARD_SIANO_DENVER_1530] = { | ||
150 | .name = "Siano Denver (ATSC-M/H) Digital Receiver", | ||
151 | .type = SMS_DENVER_1530, | ||
152 | .default_mode = DEVICE_MODE_ATSC, | ||
153 | .crystal = 2400, | ||
154 | }, | ||
155 | [SMS1XXX_BOARD_SIANO_DENVER_2160] = { | ||
156 | .name = "Siano Denver (TDMB) Digital Receiver", | ||
157 | .type = SMS_DENVER_2160, | ||
158 | .default_mode = DEVICE_MODE_DAB_TDMB, | ||
101 | }, | 159 | }, |
102 | }; | 160 | }; |
103 | 161 | ||
@@ -109,20 +167,21 @@ struct sms_board *sms_get_board(unsigned id) | |||
109 | } | 167 | } |
110 | EXPORT_SYMBOL_GPL(sms_get_board); | 168 | EXPORT_SYMBOL_GPL(sms_get_board); |
111 | static inline void sms_gpio_assign_11xx_default_led_config( | 169 | static inline void sms_gpio_assign_11xx_default_led_config( |
112 | struct smscore_gpio_config *pGpioConfig) { | 170 | struct smscore_config_gpio *p_gpio_config) { |
113 | pGpioConfig->Direction = SMS_GPIO_DIRECTION_OUTPUT; | 171 | p_gpio_config->direction = SMS_GPIO_DIRECTION_OUTPUT; |
114 | pGpioConfig->InputCharacteristics = | 172 | p_gpio_config->inputcharacteristics = |
115 | SMS_GPIO_INPUT_CHARACTERISTICS_NORMAL; | 173 | SMS_GPIO_INPUTCHARACTERISTICS_NORMAL; |
116 | pGpioConfig->OutputDriving = SMS_GPIO_OUTPUT_DRIVING_4mA; | 174 | p_gpio_config->outputdriving = SMS_GPIO_OUTPUTDRIVING_4mA; |
117 | pGpioConfig->OutputSlewRate = SMS_GPIO_OUTPUT_SLEW_RATE_0_45_V_NS; | 175 | p_gpio_config->outputslewrate = SMS_GPIO_OUTPUT_SLEW_RATE_0_45_V_NS; |
118 | pGpioConfig->PullUpDown = SMS_GPIO_PULL_UP_DOWN_NONE; | 176 | p_gpio_config->pullupdown = SMS_GPIO_PULLUPDOWN_NONE; |
119 | } | 177 | } |
120 | 178 | ||
121 | int sms_board_event(struct smscore_device_t *coredev, | 179 | int sms_board_event(struct smscore_device_t *coredev, |
122 | enum SMS_BOARD_EVENTS gevent) { | 180 | enum SMS_BOARD_EVENTS gevent) |
123 | struct smscore_gpio_config MyGpioConfig; | 181 | { |
182 | struct smscore_config_gpio my_gpio_config; | ||
124 | 183 | ||
125 | sms_gpio_assign_11xx_default_led_config(&MyGpioConfig); | 184 | sms_gpio_assign_11xx_default_led_config(&my_gpio_config); |
126 | 185 | ||
127 | switch (gevent) { | 186 | switch (gevent) { |
128 | case BOARD_EVENT_POWER_INIT: /* including hotplug */ | 187 | case BOARD_EVENT_POWER_INIT: /* including hotplug */ |
@@ -182,8 +241,8 @@ static int sms_set_gpio(struct smscore_device_t *coredev, int pin, int enable) | |||
182 | .direction = SMS_GPIO_DIRECTION_OUTPUT, | 241 | .direction = SMS_GPIO_DIRECTION_OUTPUT, |
183 | .pullupdown = SMS_GPIO_PULLUPDOWN_NONE, | 242 | .pullupdown = SMS_GPIO_PULLUPDOWN_NONE, |
184 | .inputcharacteristics = SMS_GPIO_INPUTCHARACTERISTICS_NORMAL, | 243 | .inputcharacteristics = SMS_GPIO_INPUTCHARACTERISTICS_NORMAL, |
185 | .outputslewrate = SMS_GPIO_OUTPUTSLEWRATE_FAST, | 244 | .outputslewrate = SMS_GPIO_OUTPUT_SLEW_RATE_FAST, |
186 | .outputdriving = SMS_GPIO_OUTPUTDRIVING_4mA, | 245 | .outputdriving = SMS_GPIO_OUTPUTDRIVING_S_4mA, |
187 | }; | 246 | }; |
188 | 247 | ||
189 | if (pin == 0) | 248 | if (pin == 0) |
@@ -293,19 +352,7 @@ EXPORT_SYMBOL_GPL(sms_board_lna_control); | |||
293 | 352 | ||
294 | int sms_board_load_modules(int id) | 353 | int sms_board_load_modules(int id) |
295 | { | 354 | { |
296 | switch (id) { | 355 | request_module("smsdvb"); |
297 | case SMS1XXX_BOARD_HAUPPAUGE_CATAMOUNT: | ||
298 | case SMS1XXX_BOARD_HAUPPAUGE_OKEMO_A: | ||
299 | case SMS1XXX_BOARD_HAUPPAUGE_OKEMO_B: | ||
300 | case SMS1XXX_BOARD_HAUPPAUGE_WINDHAM: | ||
301 | case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD: | ||
302 | case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD_R2: | ||
303 | request_module("smsdvb"); | ||
304 | break; | ||
305 | default: | ||
306 | /* do nothing */ | ||
307 | break; | ||
308 | } | ||
309 | return 0; | 356 | return 0; |
310 | } | 357 | } |
311 | EXPORT_SYMBOL_GPL(sms_board_load_modules); | 358 | EXPORT_SYMBOL_GPL(sms_board_load_modules); |
diff --git a/drivers/media/common/siano/sms-cards.h b/drivers/media/common/siano/sms-cards.h index d8cdf756f7cf..c63b544c49c5 100644 --- a/drivers/media/common/siano/sms-cards.h +++ b/drivers/media/common/siano/sms-cards.h | |||
@@ -37,6 +37,14 @@ | |||
37 | #define SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD_R2 10 | 37 | #define SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD_R2 10 |
38 | #define SMS1XXX_BOARD_SIANO_NICE 11 | 38 | #define SMS1XXX_BOARD_SIANO_NICE 11 |
39 | #define SMS1XXX_BOARD_SIANO_VENICE 12 | 39 | #define SMS1XXX_BOARD_SIANO_VENICE 12 |
40 | #define SMS1XXX_BOARD_SIANO_STELLAR_ROM 13 | ||
41 | #define SMS1XXX_BOARD_ZTE_DVB_DATA_CARD 14 | ||
42 | #define SMS1XXX_BOARD_ONDA_MDTV_DATA_CARD 15 | ||
43 | #define SMS1XXX_BOARD_SIANO_MING 16 | ||
44 | #define SMS1XXX_BOARD_SIANO_PELE 17 | ||
45 | #define SMS1XXX_BOARD_SIANO_RIO 18 | ||
46 | #define SMS1XXX_BOARD_SIANO_DENVER_1530 19 | ||
47 | #define SMS1XXX_BOARD_SIANO_DENVER_2160 20 | ||
40 | 48 | ||
41 | struct sms_board_gpio_cfg { | 49 | struct sms_board_gpio_cfg { |
42 | int lna_vhf_exist; | 50 | int lna_vhf_exist; |
@@ -79,6 +87,12 @@ struct sms_board { | |||
79 | 87 | ||
80 | /* gpios */ | 88 | /* gpios */ |
81 | int led_power, led_hi, led_lo, lna_ctrl, rf_switch; | 89 | int led_power, led_hi, led_lo, lna_ctrl, rf_switch; |
90 | |||
91 | char intf_num; | ||
92 | int default_mode; | ||
93 | unsigned int mtu; | ||
94 | unsigned int crystal; | ||
95 | struct sms_antenna_config_ST *antenna_config; | ||
82 | }; | 96 | }; |
83 | 97 | ||
84 | struct sms_board *sms_get_board(unsigned id); | 98 | struct sms_board *sms_get_board(unsigned id); |
diff --git a/drivers/media/common/siano/smscoreapi.c b/drivers/media/common/siano/smscoreapi.c index 1842e64e6338..45ac9eea4882 100644 --- a/drivers/media/common/siano/smscoreapi.c +++ b/drivers/media/common/siano/smscoreapi.c | |||
@@ -37,7 +37,6 @@ | |||
37 | #include "smscoreapi.h" | 37 | #include "smscoreapi.h" |
38 | #include "sms-cards.h" | 38 | #include "sms-cards.h" |
39 | #include "smsir.h" | 39 | #include "smsir.h" |
40 | #include "smsendian.h" | ||
41 | 40 | ||
42 | static int sms_dbg; | 41 | static int sms_dbg; |
43 | module_param_named(debug, sms_dbg, int, 0644); | 42 | module_param_named(debug, sms_dbg, int, 0644); |
@@ -58,11 +57,350 @@ struct smscore_client_t { | |||
58 | struct list_head entry; | 57 | struct list_head entry; |
59 | struct smscore_device_t *coredev; | 58 | struct smscore_device_t *coredev; |
60 | void *context; | 59 | void *context; |
61 | struct list_head idlist; | 60 | struct list_head idlist; |
62 | onresponse_t onresponse_handler; | 61 | onresponse_t onresponse_handler; |
63 | onremove_t onremove_handler; | 62 | onremove_t onremove_handler; |
64 | }; | 63 | }; |
65 | 64 | ||
65 | static char *siano_msgs[] = { | ||
66 | [MSG_TYPE_BASE_VAL - MSG_TYPE_BASE_VAL] = "MSG_TYPE_BASE_VAL", | ||
67 | [MSG_SMS_GET_VERSION_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_GET_VERSION_REQ", | ||
68 | [MSG_SMS_GET_VERSION_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_GET_VERSION_RES", | ||
69 | [MSG_SMS_MULTI_BRIDGE_CFG - MSG_TYPE_BASE_VAL] = "MSG_SMS_MULTI_BRIDGE_CFG", | ||
70 | [MSG_SMS_GPIO_CONFIG_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_GPIO_CONFIG_REQ", | ||
71 | [MSG_SMS_GPIO_CONFIG_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_GPIO_CONFIG_RES", | ||
72 | [MSG_SMS_GPIO_SET_LEVEL_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_GPIO_SET_LEVEL_REQ", | ||
73 | [MSG_SMS_GPIO_SET_LEVEL_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_GPIO_SET_LEVEL_RES", | ||
74 | [MSG_SMS_GPIO_GET_LEVEL_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_GPIO_GET_LEVEL_REQ", | ||
75 | [MSG_SMS_GPIO_GET_LEVEL_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_GPIO_GET_LEVEL_RES", | ||
76 | [MSG_SMS_EEPROM_BURN_IND - MSG_TYPE_BASE_VAL] = "MSG_SMS_EEPROM_BURN_IND", | ||
77 | [MSG_SMS_LOG_ENABLE_CHANGE_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_LOG_ENABLE_CHANGE_REQ", | ||
78 | [MSG_SMS_LOG_ENABLE_CHANGE_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_LOG_ENABLE_CHANGE_RES", | ||
79 | [MSG_SMS_SET_MAX_TX_MSG_LEN_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_SET_MAX_TX_MSG_LEN_REQ", | ||
80 | [MSG_SMS_SET_MAX_TX_MSG_LEN_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_SET_MAX_TX_MSG_LEN_RES", | ||
81 | [MSG_SMS_SPI_HALFDUPLEX_TOKEN_HOST_TO_DEVICE - MSG_TYPE_BASE_VAL] = "MSG_SMS_SPI_HALFDUPLEX_TOKEN_HOST_TO_DEVICE", | ||
82 | [MSG_SMS_SPI_HALFDUPLEX_TOKEN_DEVICE_TO_HOST - MSG_TYPE_BASE_VAL] = "MSG_SMS_SPI_HALFDUPLEX_TOKEN_DEVICE_TO_HOST", | ||
83 | [MSG_SMS_BACKGROUND_SCAN_FLAG_CHANGE_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_BACKGROUND_SCAN_FLAG_CHANGE_REQ", | ||
84 | [MSG_SMS_BACKGROUND_SCAN_FLAG_CHANGE_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_BACKGROUND_SCAN_FLAG_CHANGE_RES", | ||
85 | [MSG_SMS_BACKGROUND_SCAN_SIGNAL_DETECTED_IND - MSG_TYPE_BASE_VAL] = "MSG_SMS_BACKGROUND_SCAN_SIGNAL_DETECTED_IND", | ||
86 | [MSG_SMS_BACKGROUND_SCAN_NO_SIGNAL_IND - MSG_TYPE_BASE_VAL] = "MSG_SMS_BACKGROUND_SCAN_NO_SIGNAL_IND", | ||
87 | [MSG_SMS_CONFIGURE_RF_SWITCH_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_CONFIGURE_RF_SWITCH_REQ", | ||
88 | [MSG_SMS_CONFIGURE_RF_SWITCH_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_CONFIGURE_RF_SWITCH_RES", | ||
89 | [MSG_SMS_MRC_PATH_DISCONNECT_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_MRC_PATH_DISCONNECT_REQ", | ||
90 | [MSG_SMS_MRC_PATH_DISCONNECT_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_MRC_PATH_DISCONNECT_RES", | ||
91 | [MSG_SMS_RECEIVE_1SEG_THROUGH_FULLSEG_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_RECEIVE_1SEG_THROUGH_FULLSEG_REQ", | ||
92 | [MSG_SMS_RECEIVE_1SEG_THROUGH_FULLSEG_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_RECEIVE_1SEG_THROUGH_FULLSEG_RES", | ||
93 | [MSG_SMS_RECEIVE_VHF_VIA_VHF_INPUT_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_RECEIVE_VHF_VIA_VHF_INPUT_REQ", | ||
94 | [MSG_SMS_RECEIVE_VHF_VIA_VHF_INPUT_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_RECEIVE_VHF_VIA_VHF_INPUT_RES", | ||
95 | [MSG_WR_REG_RFT_REQ - MSG_TYPE_BASE_VAL] = "MSG_WR_REG_RFT_REQ", | ||
96 | [MSG_WR_REG_RFT_RES - MSG_TYPE_BASE_VAL] = "MSG_WR_REG_RFT_RES", | ||
97 | [MSG_RD_REG_RFT_REQ - MSG_TYPE_BASE_VAL] = "MSG_RD_REG_RFT_REQ", | ||
98 | [MSG_RD_REG_RFT_RES - MSG_TYPE_BASE_VAL] = "MSG_RD_REG_RFT_RES", | ||
99 | [MSG_RD_REG_ALL_RFT_REQ - MSG_TYPE_BASE_VAL] = "MSG_RD_REG_ALL_RFT_REQ", | ||
100 | [MSG_RD_REG_ALL_RFT_RES - MSG_TYPE_BASE_VAL] = "MSG_RD_REG_ALL_RFT_RES", | ||
101 | [MSG_HELP_INT - MSG_TYPE_BASE_VAL] = "MSG_HELP_INT", | ||
102 | [MSG_RUN_SCRIPT_INT - MSG_TYPE_BASE_VAL] = "MSG_RUN_SCRIPT_INT", | ||
103 | [MSG_SMS_EWS_INBAND_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_EWS_INBAND_REQ", | ||
104 | [MSG_SMS_EWS_INBAND_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_EWS_INBAND_RES", | ||
105 | [MSG_SMS_RFS_SELECT_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_RFS_SELECT_REQ", | ||
106 | [MSG_SMS_RFS_SELECT_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_RFS_SELECT_RES", | ||
107 | [MSG_SMS_MB_GET_VER_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_MB_GET_VER_REQ", | ||
108 | [MSG_SMS_MB_GET_VER_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_MB_GET_VER_RES", | ||
109 | [MSG_SMS_MB_WRITE_CFGFILE_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_MB_WRITE_CFGFILE_REQ", | ||
110 | [MSG_SMS_MB_WRITE_CFGFILE_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_MB_WRITE_CFGFILE_RES", | ||
111 | [MSG_SMS_MB_READ_CFGFILE_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_MB_READ_CFGFILE_REQ", | ||
112 | [MSG_SMS_MB_READ_CFGFILE_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_MB_READ_CFGFILE_RES", | ||
113 | [MSG_SMS_RD_MEM_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_RD_MEM_REQ", | ||
114 | [MSG_SMS_RD_MEM_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_RD_MEM_RES", | ||
115 | [MSG_SMS_WR_MEM_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_WR_MEM_REQ", | ||
116 | [MSG_SMS_WR_MEM_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_WR_MEM_RES", | ||
117 | [MSG_SMS_UPDATE_MEM_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_UPDATE_MEM_REQ", | ||
118 | [MSG_SMS_UPDATE_MEM_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_UPDATE_MEM_RES", | ||
119 | [MSG_SMS_ISDBT_ENABLE_FULL_PARAMS_SET_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_ISDBT_ENABLE_FULL_PARAMS_SET_REQ", | ||
120 | [MSG_SMS_ISDBT_ENABLE_FULL_PARAMS_SET_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_ISDBT_ENABLE_FULL_PARAMS_SET_RES", | ||
121 | [MSG_SMS_RF_TUNE_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_RF_TUNE_REQ", | ||
122 | [MSG_SMS_RF_TUNE_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_RF_TUNE_RES", | ||
123 | [MSG_SMS_ISDBT_ENABLE_HIGH_MOBILITY_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_ISDBT_ENABLE_HIGH_MOBILITY_REQ", | ||
124 | [MSG_SMS_ISDBT_ENABLE_HIGH_MOBILITY_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_ISDBT_ENABLE_HIGH_MOBILITY_RES", | ||
125 | [MSG_SMS_ISDBT_SB_RECEPTION_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_ISDBT_SB_RECEPTION_REQ", | ||
126 | [MSG_SMS_ISDBT_SB_RECEPTION_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_ISDBT_SB_RECEPTION_RES", | ||
127 | [MSG_SMS_GENERIC_EPROM_WRITE_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_GENERIC_EPROM_WRITE_REQ", | ||
128 | [MSG_SMS_GENERIC_EPROM_WRITE_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_GENERIC_EPROM_WRITE_RES", | ||
129 | [MSG_SMS_GENERIC_EPROM_READ_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_GENERIC_EPROM_READ_REQ", | ||
130 | [MSG_SMS_GENERIC_EPROM_READ_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_GENERIC_EPROM_READ_RES", | ||
131 | [MSG_SMS_EEPROM_WRITE_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_EEPROM_WRITE_REQ", | ||
132 | [MSG_SMS_EEPROM_WRITE_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_EEPROM_WRITE_RES", | ||
133 | [MSG_SMS_CUSTOM_READ_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_CUSTOM_READ_REQ", | ||
134 | [MSG_SMS_CUSTOM_READ_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_CUSTOM_READ_RES", | ||
135 | [MSG_SMS_CUSTOM_WRITE_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_CUSTOM_WRITE_REQ", | ||
136 | [MSG_SMS_CUSTOM_WRITE_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_CUSTOM_WRITE_RES", | ||
137 | [MSG_SMS_INIT_DEVICE_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_INIT_DEVICE_REQ", | ||
138 | [MSG_SMS_INIT_DEVICE_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_INIT_DEVICE_RES", | ||
139 | [MSG_SMS_ATSC_SET_ALL_IP_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_ATSC_SET_ALL_IP_REQ", | ||
140 | [MSG_SMS_ATSC_SET_ALL_IP_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_ATSC_SET_ALL_IP_RES", | ||
141 | [MSG_SMS_ATSC_START_ENSEMBLE_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_ATSC_START_ENSEMBLE_REQ", | ||
142 | [MSG_SMS_ATSC_START_ENSEMBLE_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_ATSC_START_ENSEMBLE_RES", | ||
143 | [MSG_SMS_SET_OUTPUT_MODE_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_SET_OUTPUT_MODE_REQ", | ||
144 | [MSG_SMS_SET_OUTPUT_MODE_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_SET_OUTPUT_MODE_RES", | ||
145 | [MSG_SMS_ATSC_IP_FILTER_GET_LIST_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_ATSC_IP_FILTER_GET_LIST_REQ", | ||
146 | [MSG_SMS_ATSC_IP_FILTER_GET_LIST_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_ATSC_IP_FILTER_GET_LIST_RES", | ||
147 | [MSG_SMS_SUB_CHANNEL_START_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_SUB_CHANNEL_START_REQ", | ||
148 | [MSG_SMS_SUB_CHANNEL_START_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_SUB_CHANNEL_START_RES", | ||
149 | [MSG_SMS_SUB_CHANNEL_STOP_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_SUB_CHANNEL_STOP_REQ", | ||
150 | [MSG_SMS_SUB_CHANNEL_STOP_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_SUB_CHANNEL_STOP_RES", | ||
151 | [MSG_SMS_ATSC_IP_FILTER_ADD_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_ATSC_IP_FILTER_ADD_REQ", | ||
152 | [MSG_SMS_ATSC_IP_FILTER_ADD_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_ATSC_IP_FILTER_ADD_RES", | ||
153 | [MSG_SMS_ATSC_IP_FILTER_REMOVE_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_ATSC_IP_FILTER_REMOVE_REQ", | ||
154 | [MSG_SMS_ATSC_IP_FILTER_REMOVE_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_ATSC_IP_FILTER_REMOVE_RES", | ||
155 | [MSG_SMS_ATSC_IP_FILTER_REMOVE_ALL_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_ATSC_IP_FILTER_REMOVE_ALL_REQ", | ||
156 | [MSG_SMS_ATSC_IP_FILTER_REMOVE_ALL_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_ATSC_IP_FILTER_REMOVE_ALL_RES", | ||
157 | [MSG_SMS_WAIT_CMD - MSG_TYPE_BASE_VAL] = "MSG_SMS_WAIT_CMD", | ||
158 | [MSG_SMS_ADD_PID_FILTER_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_ADD_PID_FILTER_REQ", | ||
159 | [MSG_SMS_ADD_PID_FILTER_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_ADD_PID_FILTER_RES", | ||
160 | [MSG_SMS_REMOVE_PID_FILTER_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_REMOVE_PID_FILTER_REQ", | ||
161 | [MSG_SMS_REMOVE_PID_FILTER_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_REMOVE_PID_FILTER_RES", | ||
162 | [MSG_SMS_FAST_INFORMATION_CHANNEL_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_FAST_INFORMATION_CHANNEL_REQ", | ||
163 | [MSG_SMS_FAST_INFORMATION_CHANNEL_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_FAST_INFORMATION_CHANNEL_RES", | ||
164 | [MSG_SMS_DAB_CHANNEL - MSG_TYPE_BASE_VAL] = "MSG_SMS_DAB_CHANNEL", | ||
165 | [MSG_SMS_GET_PID_FILTER_LIST_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_GET_PID_FILTER_LIST_REQ", | ||
166 | [MSG_SMS_GET_PID_FILTER_LIST_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_GET_PID_FILTER_LIST_RES", | ||
167 | [MSG_SMS_POWER_DOWN_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_POWER_DOWN_REQ", | ||
168 | [MSG_SMS_POWER_DOWN_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_POWER_DOWN_RES", | ||
169 | [MSG_SMS_ATSC_SLT_EXIST_IND - MSG_TYPE_BASE_VAL] = "MSG_SMS_ATSC_SLT_EXIST_IND", | ||
170 | [MSG_SMS_ATSC_NO_SLT_IND - MSG_TYPE_BASE_VAL] = "MSG_SMS_ATSC_NO_SLT_IND", | ||
171 | [MSG_SMS_GET_STATISTICS_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_GET_STATISTICS_REQ", | ||
172 | [MSG_SMS_GET_STATISTICS_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_GET_STATISTICS_RES", | ||
173 | [MSG_SMS_SEND_DUMP - MSG_TYPE_BASE_VAL] = "MSG_SMS_SEND_DUMP", | ||
174 | [MSG_SMS_SCAN_START_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_SCAN_START_REQ", | ||
175 | [MSG_SMS_SCAN_START_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_SCAN_START_RES", | ||
176 | [MSG_SMS_SCAN_STOP_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_SCAN_STOP_REQ", | ||
177 | [MSG_SMS_SCAN_STOP_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_SCAN_STOP_RES", | ||
178 | [MSG_SMS_SCAN_PROGRESS_IND - MSG_TYPE_BASE_VAL] = "MSG_SMS_SCAN_PROGRESS_IND", | ||
179 | [MSG_SMS_SCAN_COMPLETE_IND - MSG_TYPE_BASE_VAL] = "MSG_SMS_SCAN_COMPLETE_IND", | ||
180 | [MSG_SMS_LOG_ITEM - MSG_TYPE_BASE_VAL] = "MSG_SMS_LOG_ITEM", | ||
181 | [MSG_SMS_DAB_SUBCHANNEL_RECONFIG_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_DAB_SUBCHANNEL_RECONFIG_REQ", | ||
182 | [MSG_SMS_DAB_SUBCHANNEL_RECONFIG_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_DAB_SUBCHANNEL_RECONFIG_RES", | ||
183 | [MSG_SMS_HO_PER_SLICES_IND - MSG_TYPE_BASE_VAL] = "MSG_SMS_HO_PER_SLICES_IND", | ||
184 | [MSG_SMS_HO_INBAND_POWER_IND - MSG_TYPE_BASE_VAL] = "MSG_SMS_HO_INBAND_POWER_IND", | ||
185 | [MSG_SMS_MANUAL_DEMOD_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_MANUAL_DEMOD_REQ", | ||
186 | [MSG_SMS_HO_TUNE_ON_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_HO_TUNE_ON_REQ", | ||
187 | [MSG_SMS_HO_TUNE_ON_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_HO_TUNE_ON_RES", | ||
188 | [MSG_SMS_HO_TUNE_OFF_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_HO_TUNE_OFF_REQ", | ||
189 | [MSG_SMS_HO_TUNE_OFF_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_HO_TUNE_OFF_RES", | ||
190 | [MSG_SMS_HO_PEEK_FREQ_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_HO_PEEK_FREQ_REQ", | ||
191 | [MSG_SMS_HO_PEEK_FREQ_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_HO_PEEK_FREQ_RES", | ||
192 | [MSG_SMS_HO_PEEK_FREQ_IND - MSG_TYPE_BASE_VAL] = "MSG_SMS_HO_PEEK_FREQ_IND", | ||
193 | [MSG_SMS_MB_ATTEN_SET_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_MB_ATTEN_SET_REQ", | ||
194 | [MSG_SMS_MB_ATTEN_SET_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_MB_ATTEN_SET_RES", | ||
195 | [MSG_SMS_ENABLE_STAT_IN_I2C_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_ENABLE_STAT_IN_I2C_REQ", | ||
196 | [MSG_SMS_ENABLE_STAT_IN_I2C_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_ENABLE_STAT_IN_I2C_RES", | ||
197 | [MSG_SMS_SET_ANTENNA_CONFIG_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_SET_ANTENNA_CONFIG_REQ", | ||
198 | [MSG_SMS_SET_ANTENNA_CONFIG_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_SET_ANTENNA_CONFIG_RES", | ||
199 | [MSG_SMS_GET_STATISTICS_EX_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_GET_STATISTICS_EX_REQ", | ||
200 | [MSG_SMS_GET_STATISTICS_EX_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_GET_STATISTICS_EX_RES", | ||
201 | [MSG_SMS_SLEEP_RESUME_COMP_IND - MSG_TYPE_BASE_VAL] = "MSG_SMS_SLEEP_RESUME_COMP_IND", | ||
202 | [MSG_SMS_SWITCH_HOST_INTERFACE_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_SWITCH_HOST_INTERFACE_REQ", | ||
203 | [MSG_SMS_SWITCH_HOST_INTERFACE_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_SWITCH_HOST_INTERFACE_RES", | ||
204 | [MSG_SMS_DATA_DOWNLOAD_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_DATA_DOWNLOAD_REQ", | ||
205 | [MSG_SMS_DATA_DOWNLOAD_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_DATA_DOWNLOAD_RES", | ||
206 | [MSG_SMS_DATA_VALIDITY_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_DATA_VALIDITY_REQ", | ||
207 | [MSG_SMS_DATA_VALIDITY_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_DATA_VALIDITY_RES", | ||
208 | [MSG_SMS_SWDOWNLOAD_TRIGGER_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_SWDOWNLOAD_TRIGGER_REQ", | ||
209 | [MSG_SMS_SWDOWNLOAD_TRIGGER_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_SWDOWNLOAD_TRIGGER_RES", | ||
210 | [MSG_SMS_SWDOWNLOAD_BACKDOOR_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_SWDOWNLOAD_BACKDOOR_REQ", | ||
211 | [MSG_SMS_SWDOWNLOAD_BACKDOOR_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_SWDOWNLOAD_BACKDOOR_RES", | ||
212 | [MSG_SMS_GET_VERSION_EX_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_GET_VERSION_EX_REQ", | ||
213 | [MSG_SMS_GET_VERSION_EX_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_GET_VERSION_EX_RES", | ||
214 | [MSG_SMS_CLOCK_OUTPUT_CONFIG_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_CLOCK_OUTPUT_CONFIG_REQ", | ||
215 | [MSG_SMS_CLOCK_OUTPUT_CONFIG_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_CLOCK_OUTPUT_CONFIG_RES", | ||
216 | [MSG_SMS_I2C_SET_FREQ_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_I2C_SET_FREQ_REQ", | ||
217 | [MSG_SMS_I2C_SET_FREQ_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_I2C_SET_FREQ_RES", | ||
218 | [MSG_SMS_GENERIC_I2C_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_GENERIC_I2C_REQ", | ||
219 | [MSG_SMS_GENERIC_I2C_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_GENERIC_I2C_RES", | ||
220 | [MSG_SMS_DVBT_BDA_DATA - MSG_TYPE_BASE_VAL] = "MSG_SMS_DVBT_BDA_DATA", | ||
221 | [MSG_SW_RELOAD_REQ - MSG_TYPE_BASE_VAL] = "MSG_SW_RELOAD_REQ", | ||
222 | [MSG_SMS_DATA_MSG - MSG_TYPE_BASE_VAL] = "MSG_SMS_DATA_MSG", | ||
223 | [MSG_TABLE_UPLOAD_REQ - MSG_TYPE_BASE_VAL] = "MSG_TABLE_UPLOAD_REQ", | ||
224 | [MSG_TABLE_UPLOAD_RES - MSG_TYPE_BASE_VAL] = "MSG_TABLE_UPLOAD_RES", | ||
225 | [MSG_SW_RELOAD_START_REQ - MSG_TYPE_BASE_VAL] = "MSG_SW_RELOAD_START_REQ", | ||
226 | [MSG_SW_RELOAD_START_RES - MSG_TYPE_BASE_VAL] = "MSG_SW_RELOAD_START_RES", | ||
227 | [MSG_SW_RELOAD_EXEC_REQ - MSG_TYPE_BASE_VAL] = "MSG_SW_RELOAD_EXEC_REQ", | ||
228 | [MSG_SW_RELOAD_EXEC_RES - MSG_TYPE_BASE_VAL] = "MSG_SW_RELOAD_EXEC_RES", | ||
229 | [MSG_SMS_SPI_INT_LINE_SET_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_SPI_INT_LINE_SET_REQ", | ||
230 | [MSG_SMS_SPI_INT_LINE_SET_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_SPI_INT_LINE_SET_RES", | ||
231 | [MSG_SMS_GPIO_CONFIG_EX_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_GPIO_CONFIG_EX_REQ", | ||
232 | [MSG_SMS_GPIO_CONFIG_EX_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_GPIO_CONFIG_EX_RES", | ||
233 | [MSG_SMS_WATCHDOG_ACT_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_WATCHDOG_ACT_REQ", | ||
234 | [MSG_SMS_WATCHDOG_ACT_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_WATCHDOG_ACT_RES", | ||
235 | [MSG_SMS_LOOPBACK_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_LOOPBACK_REQ", | ||
236 | [MSG_SMS_LOOPBACK_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_LOOPBACK_RES", | ||
237 | [MSG_SMS_RAW_CAPTURE_START_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_RAW_CAPTURE_START_REQ", | ||
238 | [MSG_SMS_RAW_CAPTURE_START_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_RAW_CAPTURE_START_RES", | ||
239 | [MSG_SMS_RAW_CAPTURE_ABORT_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_RAW_CAPTURE_ABORT_REQ", | ||
240 | [MSG_SMS_RAW_CAPTURE_ABORT_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_RAW_CAPTURE_ABORT_RES", | ||
241 | [MSG_SMS_RAW_CAPTURE_COMPLETE_IND - MSG_TYPE_BASE_VAL] = "MSG_SMS_RAW_CAPTURE_COMPLETE_IND", | ||
242 | [MSG_SMS_DATA_PUMP_IND - MSG_TYPE_BASE_VAL] = "MSG_SMS_DATA_PUMP_IND", | ||
243 | [MSG_SMS_DATA_PUMP_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_DATA_PUMP_REQ", | ||
244 | [MSG_SMS_DATA_PUMP_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_DATA_PUMP_RES", | ||
245 | [MSG_SMS_FLASH_DL_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_FLASH_DL_REQ", | ||
246 | [MSG_SMS_EXEC_TEST_1_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_EXEC_TEST_1_REQ", | ||
247 | [MSG_SMS_EXEC_TEST_1_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_EXEC_TEST_1_RES", | ||
248 | [MSG_SMS_ENBALE_TS_INTERFACE_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_ENBALE_TS_INTERFACE_REQ", | ||
249 | [MSG_SMS_ENBALE_TS_INTERFACE_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_ENBALE_TS_INTERFACE_RES", | ||
250 | [MSG_SMS_SPI_SET_BUS_WIDTH_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_SPI_SET_BUS_WIDTH_REQ", | ||
251 | [MSG_SMS_SPI_SET_BUS_WIDTH_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_SPI_SET_BUS_WIDTH_RES", | ||
252 | [MSG_SMS_SEND_EMM_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_SEND_EMM_REQ", | ||
253 | [MSG_SMS_SEND_EMM_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_SEND_EMM_RES", | ||
254 | [MSG_SMS_DISABLE_TS_INTERFACE_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_DISABLE_TS_INTERFACE_REQ", | ||
255 | [MSG_SMS_DISABLE_TS_INTERFACE_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_DISABLE_TS_INTERFACE_RES", | ||
256 | [MSG_SMS_IS_BUF_FREE_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_IS_BUF_FREE_REQ", | ||
257 | [MSG_SMS_IS_BUF_FREE_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_IS_BUF_FREE_RES", | ||
258 | [MSG_SMS_EXT_ANTENNA_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_EXT_ANTENNA_REQ", | ||
259 | [MSG_SMS_EXT_ANTENNA_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_EXT_ANTENNA_RES", | ||
260 | [MSG_SMS_CMMB_GET_NET_OF_FREQ_REQ_OBSOLETE - MSG_TYPE_BASE_VAL] = "MSG_SMS_CMMB_GET_NET_OF_FREQ_REQ_OBSOLETE", | ||
261 | [MSG_SMS_CMMB_GET_NET_OF_FREQ_RES_OBSOLETE - MSG_TYPE_BASE_VAL] = "MSG_SMS_CMMB_GET_NET_OF_FREQ_RES_OBSOLETE", | ||
262 | [MSG_SMS_BATTERY_LEVEL_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_BATTERY_LEVEL_REQ", | ||
263 | [MSG_SMS_BATTERY_LEVEL_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_BATTERY_LEVEL_RES", | ||
264 | [MSG_SMS_CMMB_INJECT_TABLE_REQ_OBSOLETE - MSG_TYPE_BASE_VAL] = "MSG_SMS_CMMB_INJECT_TABLE_REQ_OBSOLETE", | ||
265 | [MSG_SMS_CMMB_INJECT_TABLE_RES_OBSOLETE - MSG_TYPE_BASE_VAL] = "MSG_SMS_CMMB_INJECT_TABLE_RES_OBSOLETE", | ||
266 | [MSG_SMS_FM_RADIO_BLOCK_IND - MSG_TYPE_BASE_VAL] = "MSG_SMS_FM_RADIO_BLOCK_IND", | ||
267 | [MSG_SMS_HOST_NOTIFICATION_IND - MSG_TYPE_BASE_VAL] = "MSG_SMS_HOST_NOTIFICATION_IND", | ||
268 | [MSG_SMS_CMMB_GET_CONTROL_TABLE_REQ_OBSOLETE - MSG_TYPE_BASE_VAL] = "MSG_SMS_CMMB_GET_CONTROL_TABLE_REQ_OBSOLETE", | ||
269 | [MSG_SMS_CMMB_GET_CONTROL_TABLE_RES_OBSOLETE - MSG_TYPE_BASE_VAL] = "MSG_SMS_CMMB_GET_CONTROL_TABLE_RES_OBSOLETE", | ||
270 | [MSG_SMS_CMMB_GET_NETWORKS_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_CMMB_GET_NETWORKS_REQ", | ||
271 | [MSG_SMS_CMMB_GET_NETWORKS_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_CMMB_GET_NETWORKS_RES", | ||
272 | [MSG_SMS_CMMB_START_SERVICE_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_CMMB_START_SERVICE_REQ", | ||
273 | [MSG_SMS_CMMB_START_SERVICE_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_CMMB_START_SERVICE_RES", | ||
274 | [MSG_SMS_CMMB_STOP_SERVICE_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_CMMB_STOP_SERVICE_REQ", | ||
275 | [MSG_SMS_CMMB_STOP_SERVICE_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_CMMB_STOP_SERVICE_RES", | ||
276 | [MSG_SMS_CMMB_ADD_CHANNEL_FILTER_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_CMMB_ADD_CHANNEL_FILTER_REQ", | ||
277 | [MSG_SMS_CMMB_ADD_CHANNEL_FILTER_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_CMMB_ADD_CHANNEL_FILTER_RES", | ||
278 | [MSG_SMS_CMMB_REMOVE_CHANNEL_FILTER_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_CMMB_REMOVE_CHANNEL_FILTER_REQ", | ||
279 | [MSG_SMS_CMMB_REMOVE_CHANNEL_FILTER_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_CMMB_REMOVE_CHANNEL_FILTER_RES", | ||
280 | [MSG_SMS_CMMB_START_CONTROL_INFO_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_CMMB_START_CONTROL_INFO_REQ", | ||
281 | [MSG_SMS_CMMB_START_CONTROL_INFO_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_CMMB_START_CONTROL_INFO_RES", | ||
282 | [MSG_SMS_CMMB_STOP_CONTROL_INFO_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_CMMB_STOP_CONTROL_INFO_REQ", | ||
283 | [MSG_SMS_CMMB_STOP_CONTROL_INFO_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_CMMB_STOP_CONTROL_INFO_RES", | ||
284 | [MSG_SMS_ISDBT_TUNE_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_ISDBT_TUNE_REQ", | ||
285 | [MSG_SMS_ISDBT_TUNE_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_ISDBT_TUNE_RES", | ||
286 | [MSG_SMS_TRANSMISSION_IND - MSG_TYPE_BASE_VAL] = "MSG_SMS_TRANSMISSION_IND", | ||
287 | [MSG_SMS_PID_STATISTICS_IND - MSG_TYPE_BASE_VAL] = "MSG_SMS_PID_STATISTICS_IND", | ||
288 | [MSG_SMS_POWER_DOWN_IND - MSG_TYPE_BASE_VAL] = "MSG_SMS_POWER_DOWN_IND", | ||
289 | [MSG_SMS_POWER_DOWN_CONF - MSG_TYPE_BASE_VAL] = "MSG_SMS_POWER_DOWN_CONF", | ||
290 | [MSG_SMS_POWER_UP_IND - MSG_TYPE_BASE_VAL] = "MSG_SMS_POWER_UP_IND", | ||
291 | [MSG_SMS_POWER_UP_CONF - MSG_TYPE_BASE_VAL] = "MSG_SMS_POWER_UP_CONF", | ||
292 | [MSG_SMS_POWER_MODE_SET_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_POWER_MODE_SET_REQ", | ||
293 | [MSG_SMS_POWER_MODE_SET_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_POWER_MODE_SET_RES", | ||
294 | [MSG_SMS_DEBUG_HOST_EVENT_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_DEBUG_HOST_EVENT_REQ", | ||
295 | [MSG_SMS_DEBUG_HOST_EVENT_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_DEBUG_HOST_EVENT_RES", | ||
296 | [MSG_SMS_NEW_CRYSTAL_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_NEW_CRYSTAL_REQ", | ||
297 | [MSG_SMS_NEW_CRYSTAL_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_NEW_CRYSTAL_RES", | ||
298 | [MSG_SMS_CONFIG_SPI_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_CONFIG_SPI_REQ", | ||
299 | [MSG_SMS_CONFIG_SPI_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_CONFIG_SPI_RES", | ||
300 | [MSG_SMS_I2C_SHORT_STAT_IND - MSG_TYPE_BASE_VAL] = "MSG_SMS_I2C_SHORT_STAT_IND", | ||
301 | [MSG_SMS_START_IR_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_START_IR_REQ", | ||
302 | [MSG_SMS_START_IR_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_START_IR_RES", | ||
303 | [MSG_SMS_IR_SAMPLES_IND - MSG_TYPE_BASE_VAL] = "MSG_SMS_IR_SAMPLES_IND", | ||
304 | [MSG_SMS_CMMB_CA_SERVICE_IND - MSG_TYPE_BASE_VAL] = "MSG_SMS_CMMB_CA_SERVICE_IND", | ||
305 | [MSG_SMS_SLAVE_DEVICE_DETECTED - MSG_TYPE_BASE_VAL] = "MSG_SMS_SLAVE_DEVICE_DETECTED", | ||
306 | [MSG_SMS_INTERFACE_LOCK_IND - MSG_TYPE_BASE_VAL] = "MSG_SMS_INTERFACE_LOCK_IND", | ||
307 | [MSG_SMS_INTERFACE_UNLOCK_IND - MSG_TYPE_BASE_VAL] = "MSG_SMS_INTERFACE_UNLOCK_IND", | ||
308 | [MSG_SMS_SEND_ROSUM_BUFF_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_SEND_ROSUM_BUFF_REQ", | ||
309 | [MSG_SMS_SEND_ROSUM_BUFF_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_SEND_ROSUM_BUFF_RES", | ||
310 | [MSG_SMS_ROSUM_BUFF - MSG_TYPE_BASE_VAL] = "MSG_SMS_ROSUM_BUFF", | ||
311 | [MSG_SMS_SET_AES128_KEY_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_SET_AES128_KEY_REQ", | ||
312 | [MSG_SMS_SET_AES128_KEY_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_SET_AES128_KEY_RES", | ||
313 | [MSG_SMS_MBBMS_WRITE_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_MBBMS_WRITE_REQ", | ||
314 | [MSG_SMS_MBBMS_WRITE_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_MBBMS_WRITE_RES", | ||
315 | [MSG_SMS_MBBMS_READ_IND - MSG_TYPE_BASE_VAL] = "MSG_SMS_MBBMS_READ_IND", | ||
316 | [MSG_SMS_IQ_STREAM_START_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_IQ_STREAM_START_REQ", | ||
317 | [MSG_SMS_IQ_STREAM_START_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_IQ_STREAM_START_RES", | ||
318 | [MSG_SMS_IQ_STREAM_STOP_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_IQ_STREAM_STOP_REQ", | ||
319 | [MSG_SMS_IQ_STREAM_STOP_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_IQ_STREAM_STOP_RES", | ||
320 | [MSG_SMS_IQ_STREAM_DATA_BLOCK - MSG_TYPE_BASE_VAL] = "MSG_SMS_IQ_STREAM_DATA_BLOCK", | ||
321 | [MSG_SMS_GET_EEPROM_VERSION_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_GET_EEPROM_VERSION_REQ", | ||
322 | [MSG_SMS_GET_EEPROM_VERSION_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_GET_EEPROM_VERSION_RES", | ||
323 | [MSG_SMS_SIGNAL_DETECTED_IND - MSG_TYPE_BASE_VAL] = "MSG_SMS_SIGNAL_DETECTED_IND", | ||
324 | [MSG_SMS_NO_SIGNAL_IND - MSG_TYPE_BASE_VAL] = "MSG_SMS_NO_SIGNAL_IND", | ||
325 | [MSG_SMS_MRC_SHUTDOWN_SLAVE_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_MRC_SHUTDOWN_SLAVE_REQ", | ||
326 | [MSG_SMS_MRC_SHUTDOWN_SLAVE_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_MRC_SHUTDOWN_SLAVE_RES", | ||
327 | [MSG_SMS_MRC_BRINGUP_SLAVE_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_MRC_BRINGUP_SLAVE_REQ", | ||
328 | [MSG_SMS_MRC_BRINGUP_SLAVE_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_MRC_BRINGUP_SLAVE_RES", | ||
329 | [MSG_SMS_EXTERNAL_LNA_CTRL_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_EXTERNAL_LNA_CTRL_REQ", | ||
330 | [MSG_SMS_EXTERNAL_LNA_CTRL_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_EXTERNAL_LNA_CTRL_RES", | ||
331 | [MSG_SMS_SET_PERIODIC_STATISTICS_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_SET_PERIODIC_STATISTICS_REQ", | ||
332 | [MSG_SMS_SET_PERIODIC_STATISTICS_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_SET_PERIODIC_STATISTICS_RES", | ||
333 | [MSG_SMS_CMMB_SET_AUTO_OUTPUT_TS0_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_CMMB_SET_AUTO_OUTPUT_TS0_REQ", | ||
334 | [MSG_SMS_CMMB_SET_AUTO_OUTPUT_TS0_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_CMMB_SET_AUTO_OUTPUT_TS0_RES", | ||
335 | [LOCAL_TUNE - MSG_TYPE_BASE_VAL] = "LOCAL_TUNE", | ||
336 | [LOCAL_IFFT_H_ICI - MSG_TYPE_BASE_VAL] = "LOCAL_IFFT_H_ICI", | ||
337 | [MSG_RESYNC_REQ - MSG_TYPE_BASE_VAL] = "MSG_RESYNC_REQ", | ||
338 | [MSG_SMS_CMMB_GET_MRC_STATISTICS_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_CMMB_GET_MRC_STATISTICS_REQ", | ||
339 | [MSG_SMS_CMMB_GET_MRC_STATISTICS_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_CMMB_GET_MRC_STATISTICS_RES", | ||
340 | [MSG_SMS_LOG_EX_ITEM - MSG_TYPE_BASE_VAL] = "MSG_SMS_LOG_EX_ITEM", | ||
341 | [MSG_SMS_DEVICE_DATA_LOSS_IND - MSG_TYPE_BASE_VAL] = "MSG_SMS_DEVICE_DATA_LOSS_IND", | ||
342 | [MSG_SMS_MRC_WATCHDOG_TRIGGERED_IND - MSG_TYPE_BASE_VAL] = "MSG_SMS_MRC_WATCHDOG_TRIGGERED_IND", | ||
343 | [MSG_SMS_USER_MSG_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_USER_MSG_REQ", | ||
344 | [MSG_SMS_USER_MSG_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_USER_MSG_RES", | ||
345 | [MSG_SMS_SMART_CARD_INIT_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_SMART_CARD_INIT_REQ", | ||
346 | [MSG_SMS_SMART_CARD_INIT_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_SMART_CARD_INIT_RES", | ||
347 | [MSG_SMS_SMART_CARD_WRITE_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_SMART_CARD_WRITE_REQ", | ||
348 | [MSG_SMS_SMART_CARD_WRITE_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_SMART_CARD_WRITE_RES", | ||
349 | [MSG_SMS_SMART_CARD_READ_IND - MSG_TYPE_BASE_VAL] = "MSG_SMS_SMART_CARD_READ_IND", | ||
350 | [MSG_SMS_TSE_ENABLE_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_TSE_ENABLE_REQ", | ||
351 | [MSG_SMS_TSE_ENABLE_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_TSE_ENABLE_RES", | ||
352 | [MSG_SMS_CMMB_GET_SHORT_STATISTICS_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_CMMB_GET_SHORT_STATISTICS_REQ", | ||
353 | [MSG_SMS_CMMB_GET_SHORT_STATISTICS_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_CMMB_GET_SHORT_STATISTICS_RES", | ||
354 | [MSG_SMS_LED_CONFIG_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_LED_CONFIG_REQ", | ||
355 | [MSG_SMS_LED_CONFIG_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_LED_CONFIG_RES", | ||
356 | [MSG_PWM_ANTENNA_REQ - MSG_TYPE_BASE_VAL] = "MSG_PWM_ANTENNA_REQ", | ||
357 | [MSG_PWM_ANTENNA_RES - MSG_TYPE_BASE_VAL] = "MSG_PWM_ANTENNA_RES", | ||
358 | [MSG_SMS_CMMB_SMD_SN_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_CMMB_SMD_SN_REQ", | ||
359 | [MSG_SMS_CMMB_SMD_SN_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_CMMB_SMD_SN_RES", | ||
360 | [MSG_SMS_CMMB_SET_CA_CW_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_CMMB_SET_CA_CW_REQ", | ||
361 | [MSG_SMS_CMMB_SET_CA_CW_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_CMMB_SET_CA_CW_RES", | ||
362 | [MSG_SMS_CMMB_SET_CA_SALT_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_CMMB_SET_CA_SALT_REQ", | ||
363 | [MSG_SMS_CMMB_SET_CA_SALT_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_CMMB_SET_CA_SALT_RES", | ||
364 | [MSG_SMS_NSCD_INIT_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_NSCD_INIT_REQ", | ||
365 | [MSG_SMS_NSCD_INIT_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_NSCD_INIT_RES", | ||
366 | [MSG_SMS_NSCD_PROCESS_SECTION_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_NSCD_PROCESS_SECTION_REQ", | ||
367 | [MSG_SMS_NSCD_PROCESS_SECTION_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_NSCD_PROCESS_SECTION_RES", | ||
368 | [MSG_SMS_DBD_CREATE_OBJECT_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_DBD_CREATE_OBJECT_REQ", | ||
369 | [MSG_SMS_DBD_CREATE_OBJECT_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_DBD_CREATE_OBJECT_RES", | ||
370 | [MSG_SMS_DBD_CONFIGURE_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_DBD_CONFIGURE_REQ", | ||
371 | [MSG_SMS_DBD_CONFIGURE_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_DBD_CONFIGURE_RES", | ||
372 | [MSG_SMS_DBD_SET_KEYS_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_DBD_SET_KEYS_REQ", | ||
373 | [MSG_SMS_DBD_SET_KEYS_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_DBD_SET_KEYS_RES", | ||
374 | [MSG_SMS_DBD_PROCESS_HEADER_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_DBD_PROCESS_HEADER_REQ", | ||
375 | [MSG_SMS_DBD_PROCESS_HEADER_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_DBD_PROCESS_HEADER_RES", | ||
376 | [MSG_SMS_DBD_PROCESS_DATA_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_DBD_PROCESS_DATA_REQ", | ||
377 | [MSG_SMS_DBD_PROCESS_DATA_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_DBD_PROCESS_DATA_RES", | ||
378 | [MSG_SMS_DBD_PROCESS_GET_DATA_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_DBD_PROCESS_GET_DATA_REQ", | ||
379 | [MSG_SMS_DBD_PROCESS_GET_DATA_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_DBD_PROCESS_GET_DATA_RES", | ||
380 | [MSG_SMS_NSCD_OPEN_SESSION_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_NSCD_OPEN_SESSION_REQ", | ||
381 | [MSG_SMS_NSCD_OPEN_SESSION_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_NSCD_OPEN_SESSION_RES", | ||
382 | [MSG_SMS_SEND_HOST_DATA_TO_DEMUX_REQ - MSG_TYPE_BASE_VAL] = "MSG_SMS_SEND_HOST_DATA_TO_DEMUX_REQ", | ||
383 | [MSG_SMS_SEND_HOST_DATA_TO_DEMUX_RES - MSG_TYPE_BASE_VAL] = "MSG_SMS_SEND_HOST_DATA_TO_DEMUX_RES", | ||
384 | [MSG_LAST_MSG_TYPE - MSG_TYPE_BASE_VAL] = "MSG_LAST_MSG_TYPE", | ||
385 | }; | ||
386 | |||
387 | char *smscore_translate_msg(enum msg_types msgtype) | ||
388 | { | ||
389 | int i = msgtype - MSG_TYPE_BASE_VAL; | ||
390 | char *msg; | ||
391 | |||
392 | if (i < 0 || i >= ARRAY_SIZE(siano_msgs)) | ||
393 | return "Unknown msg type"; | ||
394 | |||
395 | msg = siano_msgs[i]; | ||
396 | |||
397 | if (!*msg) | ||
398 | return "Unknown msg type"; | ||
399 | |||
400 | return msg; | ||
401 | } | ||
402 | EXPORT_SYMBOL_GPL(smscore_translate_msg); | ||
403 | |||
66 | void smscore_set_board_id(struct smscore_device_t *core, int id) | 404 | void smscore_set_board_id(struct smscore_device_t *core, int id) |
67 | { | 405 | { |
68 | core->board_id = id; | 406 | core->board_id = id; |
@@ -96,7 +434,7 @@ static struct mutex g_smscore_deviceslock; | |||
96 | static struct list_head g_smscore_registry; | 434 | static struct list_head g_smscore_registry; |
97 | static struct mutex g_smscore_registrylock; | 435 | static struct mutex g_smscore_registrylock; |
98 | 436 | ||
99 | static int default_mode = 4; | 437 | static int default_mode = DEVICE_MODE_NONE; |
100 | 438 | ||
101 | module_param(default_mode, int, 0644); | 439 | module_param(default_mode, int, 0644); |
102 | MODULE_PARM_DESC(default_mode, "default firmware id (device mode)"); | 440 | MODULE_PARM_DESC(default_mode, "default firmware id (device mode)"); |
@@ -151,10 +489,10 @@ static enum sms_device_type_st smscore_registry_gettype(char *devpath) | |||
151 | else | 489 | else |
152 | sms_err("No registry found."); | 490 | sms_err("No registry found."); |
153 | 491 | ||
154 | return -1; | 492 | return -EINVAL; |
155 | } | 493 | } |
156 | 494 | ||
157 | void smscore_registry_setmode(char *devpath, int mode) | 495 | static void smscore_registry_setmode(char *devpath, int mode) |
158 | { | 496 | { |
159 | struct smscore_registry_entry_t *entry; | 497 | struct smscore_registry_entry_t *entry; |
160 | 498 | ||
@@ -294,10 +632,11 @@ static struct | |||
294 | smscore_buffer_t *smscore_createbuffer(u8 *buffer, void *common_buffer, | 632 | smscore_buffer_t *smscore_createbuffer(u8 *buffer, void *common_buffer, |
295 | dma_addr_t common_buffer_phys) | 633 | dma_addr_t common_buffer_phys) |
296 | { | 634 | { |
297 | struct smscore_buffer_t *cb = | 635 | struct smscore_buffer_t *cb; |
298 | kmalloc(sizeof(struct smscore_buffer_t), GFP_KERNEL); | 636 | |
637 | cb = kzalloc(sizeof(struct smscore_buffer_t), GFP_KERNEL); | ||
299 | if (!cb) { | 638 | if (!cb) { |
300 | sms_info("kmalloc(...) failed"); | 639 | sms_info("kzalloc(...) failed"); |
301 | return NULL; | 640 | return NULL; |
302 | } | 641 | } |
303 | 642 | ||
@@ -344,6 +683,7 @@ int smscore_register_device(struct smsdevice_params_t *params, | |||
344 | /* init completion events */ | 683 | /* init completion events */ |
345 | init_completion(&dev->version_ex_done); | 684 | init_completion(&dev->version_ex_done); |
346 | init_completion(&dev->data_download_done); | 685 | init_completion(&dev->data_download_done); |
686 | init_completion(&dev->data_validity_done); | ||
347 | init_completion(&dev->trigger_done); | 687 | init_completion(&dev->trigger_done); |
348 | init_completion(&dev->init_device_done); | 688 | init_completion(&dev->init_device_done); |
349 | init_completion(&dev->reload_start_done); | 689 | init_completion(&dev->reload_start_done); |
@@ -370,9 +710,10 @@ int smscore_register_device(struct smsdevice_params_t *params, | |||
370 | for (buffer = dev->common_buffer; | 710 | for (buffer = dev->common_buffer; |
371 | dev->num_buffers < params->num_buffers; | 711 | dev->num_buffers < params->num_buffers; |
372 | dev->num_buffers++, buffer += params->buffer_size) { | 712 | dev->num_buffers++, buffer += params->buffer_size) { |
373 | struct smscore_buffer_t *cb = | 713 | struct smscore_buffer_t *cb; |
374 | smscore_createbuffer(buffer, dev->common_buffer, | 714 | |
375 | dev->common_buffer_phys); | 715 | cb = smscore_createbuffer(buffer, dev->common_buffer, |
716 | dev->common_buffer_phys); | ||
376 | if (!cb) { | 717 | if (!cb) { |
377 | smscore_unregister_device(dev); | 718 | smscore_unregister_device(dev); |
378 | return -ENOMEM; | 719 | return -ENOMEM; |
@@ -384,6 +725,7 @@ int smscore_register_device(struct smsdevice_params_t *params, | |||
384 | sms_info("allocated %d buffers", dev->num_buffers); | 725 | sms_info("allocated %d buffers", dev->num_buffers); |
385 | 726 | ||
386 | dev->mode = DEVICE_MODE_NONE; | 727 | dev->mode = DEVICE_MODE_NONE; |
728 | dev->board_id = SMS_BOARD_UNKNOWN; | ||
387 | dev->context = params->context; | 729 | dev->context = params->context; |
388 | dev->device = params->device; | 730 | dev->device = params->device; |
389 | dev->setmode_handler = params->setmode_handler; | 731 | dev->setmode_handler = params->setmode_handler; |
@@ -413,7 +755,13 @@ EXPORT_SYMBOL_GPL(smscore_register_device); | |||
413 | 755 | ||
414 | static int smscore_sendrequest_and_wait(struct smscore_device_t *coredev, | 756 | static int smscore_sendrequest_and_wait(struct smscore_device_t *coredev, |
415 | void *buffer, size_t size, struct completion *completion) { | 757 | void *buffer, size_t size, struct completion *completion) { |
416 | int rc = coredev->sendrequest_handler(coredev->context, buffer, size); | 758 | int rc; |
759 | |||
760 | if (completion == NULL) | ||
761 | return -EINVAL; | ||
762 | init_completion(completion); | ||
763 | |||
764 | rc = coredev->sendrequest_handler(coredev->context, buffer, size); | ||
417 | if (rc < 0) { | 765 | if (rc < 0) { |
418 | sms_info("sendrequest returned error %d", rc); | 766 | sms_info("sendrequest returned error %d", rc); |
419 | return rc; | 767 | return rc; |
@@ -444,24 +792,22 @@ static int smscore_init_ir(struct smscore_device_t *coredev) | |||
444 | if (rc != 0) | 792 | if (rc != 0) |
445 | sms_err("Error initialization DTV IR sub-module"); | 793 | sms_err("Error initialization DTV IR sub-module"); |
446 | else { | 794 | else { |
447 | buffer = kmalloc(sizeof(struct SmsMsgData_ST2) + | 795 | buffer = kmalloc(sizeof(struct sms_msg_data2) + |
448 | SMS_DMA_ALIGNMENT, | 796 | SMS_DMA_ALIGNMENT, |
449 | GFP_KERNEL | GFP_DMA); | 797 | GFP_KERNEL | GFP_DMA); |
450 | if (buffer) { | 798 | if (buffer) { |
451 | struct SmsMsgData_ST2 *msg = | 799 | struct sms_msg_data2 *msg = |
452 | (struct SmsMsgData_ST2 *) | 800 | (struct sms_msg_data2 *) |
453 | SMS_ALIGN_ADDRESS(buffer); | 801 | SMS_ALIGN_ADDRESS(buffer); |
454 | 802 | ||
455 | SMS_INIT_MSG(&msg->xMsgHeader, | 803 | SMS_INIT_MSG(&msg->x_msg_header, |
456 | MSG_SMS_START_IR_REQ, | 804 | MSG_SMS_START_IR_REQ, |
457 | sizeof(struct SmsMsgData_ST2)); | 805 | sizeof(struct sms_msg_data2)); |
458 | msg->msgData[0] = coredev->ir.controller; | 806 | msg->msg_data[0] = coredev->ir.controller; |
459 | msg->msgData[1] = coredev->ir.timeout; | 807 | msg->msg_data[1] = coredev->ir.timeout; |
460 | 808 | ||
461 | smsendian_handle_tx_message( | ||
462 | (struct SmsMsgHdr_ST2 *)msg); | ||
463 | rc = smscore_sendrequest_and_wait(coredev, msg, | 809 | rc = smscore_sendrequest_and_wait(coredev, msg, |
464 | msg->xMsgHeader. msgLength, | 810 | msg->x_msg_header. msg_length, |
465 | &coredev->ir_init_done); | 811 | &coredev->ir_init_done); |
466 | 812 | ||
467 | kfree(buffer); | 813 | kfree(buffer); |
@@ -476,21 +822,82 @@ static int smscore_init_ir(struct smscore_device_t *coredev) | |||
476 | } | 822 | } |
477 | 823 | ||
478 | /** | 824 | /** |
825 | * configures device features according to board configuration structure. | ||
826 | * | ||
827 | * @param coredev pointer to a coredev object returned by | ||
828 | * smscore_register_device | ||
829 | * | ||
830 | * @return 0 on success, <0 on error. | ||
831 | */ | ||
832 | static int smscore_configure_board(struct smscore_device_t *coredev) | ||
833 | { | ||
834 | struct sms_board *board; | ||
835 | |||
836 | board = sms_get_board(coredev->board_id); | ||
837 | if (!board) { | ||
838 | sms_err("no board configuration exist."); | ||
839 | return -EINVAL; | ||
840 | } | ||
841 | |||
842 | if (board->mtu) { | ||
843 | struct sms_msg_data mtu_msg; | ||
844 | sms_debug("set max transmit unit %d", board->mtu); | ||
845 | |||
846 | mtu_msg.x_msg_header.msg_src_id = 0; | ||
847 | mtu_msg.x_msg_header.msg_dst_id = HIF_TASK; | ||
848 | mtu_msg.x_msg_header.msg_flags = 0; | ||
849 | mtu_msg.x_msg_header.msg_type = MSG_SMS_SET_MAX_TX_MSG_LEN_REQ; | ||
850 | mtu_msg.x_msg_header.msg_length = sizeof(mtu_msg); | ||
851 | mtu_msg.msg_data[0] = board->mtu; | ||
852 | |||
853 | coredev->sendrequest_handler(coredev->context, &mtu_msg, | ||
854 | sizeof(mtu_msg)); | ||
855 | } | ||
856 | |||
857 | if (board->crystal) { | ||
858 | struct sms_msg_data crys_msg; | ||
859 | sms_debug("set crystal value %d", board->crystal); | ||
860 | |||
861 | SMS_INIT_MSG(&crys_msg.x_msg_header, | ||
862 | MSG_SMS_NEW_CRYSTAL_REQ, | ||
863 | sizeof(crys_msg)); | ||
864 | crys_msg.msg_data[0] = board->crystal; | ||
865 | |||
866 | coredev->sendrequest_handler(coredev->context, &crys_msg, | ||
867 | sizeof(crys_msg)); | ||
868 | } | ||
869 | |||
870 | return 0; | ||
871 | } | ||
872 | |||
873 | /** | ||
479 | * sets initial device mode and notifies client hotplugs that device is ready | 874 | * sets initial device mode and notifies client hotplugs that device is ready |
480 | * | 875 | * |
481 | * @param coredev pointer to a coredev object returned by | 876 | * @param coredev pointer to a coredev object returned by |
482 | * smscore_register_device | 877 | * smscore_register_device |
483 | * | 878 | * |
484 | * @return 0 on success, <0 on error. | 879 | * @return 0 on success, <0 on error. |
485 | */ | 880 | */ |
486 | int smscore_start_device(struct smscore_device_t *coredev) | 881 | int smscore_start_device(struct smscore_device_t *coredev) |
487 | { | 882 | { |
488 | int rc = smscore_set_device_mode( | 883 | int rc; |
489 | coredev, smscore_registry_getmode(coredev->devpath)); | 884 | int board_id = smscore_get_board_id(coredev); |
885 | int mode = smscore_registry_getmode(coredev->devpath); | ||
886 | |||
887 | /* Device is initialized as DEVICE_MODE_NONE */ | ||
888 | if (board_id != SMS_BOARD_UNKNOWN && mode == DEVICE_MODE_NONE) | ||
889 | mode = sms_get_board(board_id)->default_mode; | ||
890 | |||
891 | rc = smscore_set_device_mode(coredev, mode); | ||
490 | if (rc < 0) { | 892 | if (rc < 0) { |
491 | sms_info("set device mode faile , rc %d", rc); | 893 | sms_info("set device mode faile , rc %d", rc); |
492 | return rc; | 894 | return rc; |
493 | } | 895 | } |
896 | rc = smscore_configure_board(coredev); | ||
897 | if (rc < 0) { | ||
898 | sms_info("configure board failed , rc %d", rc); | ||
899 | return rc; | ||
900 | } | ||
494 | 901 | ||
495 | kmutex_lock(&g_smscore_deviceslock); | 902 | kmutex_lock(&g_smscore_deviceslock); |
496 | 903 | ||
@@ -509,18 +916,19 @@ EXPORT_SYMBOL_GPL(smscore_start_device); | |||
509 | static int smscore_load_firmware_family2(struct smscore_device_t *coredev, | 916 | static int smscore_load_firmware_family2(struct smscore_device_t *coredev, |
510 | void *buffer, size_t size) | 917 | void *buffer, size_t size) |
511 | { | 918 | { |
512 | struct SmsFirmware_ST *firmware = (struct SmsFirmware_ST *) buffer; | 919 | struct sms_firmware *firmware = (struct sms_firmware *) buffer; |
513 | struct SmsMsgHdr_ST *msg; | 920 | struct sms_msg_data4 *msg; |
514 | u32 mem_address; | 921 | u32 mem_address, calc_checksum = 0; |
515 | u8 *payload = firmware->Payload; | 922 | u32 i, *ptr; |
923 | u8 *payload = firmware->payload; | ||
516 | int rc = 0; | 924 | int rc = 0; |
517 | firmware->StartAddress = le32_to_cpu(firmware->StartAddress); | 925 | firmware->start_address = le32_to_cpu(firmware->start_address); |
518 | firmware->Length = le32_to_cpu(firmware->Length); | 926 | firmware->length = le32_to_cpu(firmware->length); |
519 | 927 | ||
520 | mem_address = firmware->StartAddress; | 928 | mem_address = firmware->start_address; |
521 | 929 | ||
522 | sms_info("loading FW to addr 0x%x size %d", | 930 | sms_info("loading FW to addr 0x%x size %d", |
523 | mem_address, firmware->Length); | 931 | mem_address, firmware->length); |
524 | if (coredev->preload_handler) { | 932 | if (coredev->preload_handler) { |
525 | rc = coredev->preload_handler(coredev->context); | 933 | rc = coredev->preload_handler(coredev->context); |
526 | if (rc < 0) | 934 | if (rc < 0) |
@@ -534,35 +942,36 @@ static int smscore_load_firmware_family2(struct smscore_device_t *coredev, | |||
534 | 942 | ||
535 | if (coredev->mode != DEVICE_MODE_NONE) { | 943 | if (coredev->mode != DEVICE_MODE_NONE) { |
536 | sms_debug("sending reload command."); | 944 | sms_debug("sending reload command."); |
537 | SMS_INIT_MSG(msg, MSG_SW_RELOAD_START_REQ, | 945 | SMS_INIT_MSG(&msg->x_msg_header, MSG_SW_RELOAD_START_REQ, |
538 | sizeof(struct SmsMsgHdr_ST)); | 946 | sizeof(struct sms_msg_hdr)); |
539 | rc = smscore_sendrequest_and_wait(coredev, msg, | 947 | rc = smscore_sendrequest_and_wait(coredev, msg, |
540 | msg->msgLength, | 948 | msg->x_msg_header.msg_length, |
541 | &coredev->reload_start_done); | 949 | &coredev->reload_start_done); |
950 | if (rc < 0) { | ||
951 | sms_err("device reload failed, rc %d", rc); | ||
952 | goto exit_fw_download; | ||
953 | } | ||
542 | mem_address = *(u32 *) &payload[20]; | 954 | mem_address = *(u32 *) &payload[20]; |
543 | } | 955 | } |
544 | 956 | ||
957 | for (i = 0, ptr = (u32 *)firmware->payload; i < firmware->length/4 ; | ||
958 | i++, ptr++) | ||
959 | calc_checksum += *ptr; | ||
960 | |||
545 | while (size && rc >= 0) { | 961 | while (size && rc >= 0) { |
546 | struct SmsDataDownload_ST *DataMsg = | 962 | struct sms_data_download *data_msg = |
547 | (struct SmsDataDownload_ST *) msg; | 963 | (struct sms_data_download *) msg; |
548 | int payload_size = min((int) size, SMS_MAX_PAYLOAD_SIZE); | 964 | int payload_size = min_t(int, size, SMS_MAX_PAYLOAD_SIZE); |
549 | 965 | ||
550 | SMS_INIT_MSG(msg, MSG_SMS_DATA_DOWNLOAD_REQ, | 966 | SMS_INIT_MSG(&msg->x_msg_header, MSG_SMS_DATA_DOWNLOAD_REQ, |
551 | (u16)(sizeof(struct SmsMsgHdr_ST) + | 967 | (u16)(sizeof(struct sms_msg_hdr) + |
552 | sizeof(u32) + payload_size)); | 968 | sizeof(u32) + payload_size)); |
553 | 969 | ||
554 | DataMsg->MemAddr = mem_address; | 970 | data_msg->mem_addr = mem_address; |
555 | memcpy(DataMsg->Payload, payload, payload_size); | 971 | memcpy(data_msg->payload, payload, payload_size); |
556 | 972 | ||
557 | if ((coredev->device_flags & SMS_ROM_NO_RESPONSE) && | 973 | rc = smscore_sendrequest_and_wait(coredev, data_msg, |
558 | (coredev->mode == DEVICE_MODE_NONE)) | 974 | data_msg->x_msg_header.msg_length, |
559 | rc = coredev->sendrequest_handler( | ||
560 | coredev->context, DataMsg, | ||
561 | DataMsg->xMsgHeader.msgLength); | ||
562 | else | ||
563 | rc = smscore_sendrequest_and_wait( | ||
564 | coredev, DataMsg, | ||
565 | DataMsg->xMsgHeader.msgLength, | ||
566 | &coredev->data_download_done); | 975 | &coredev->data_download_done); |
567 | 976 | ||
568 | payload += payload_size; | 977 | payload += payload_size; |
@@ -570,50 +979,158 @@ static int smscore_load_firmware_family2(struct smscore_device_t *coredev, | |||
570 | mem_address += payload_size; | 979 | mem_address += payload_size; |
571 | } | 980 | } |
572 | 981 | ||
573 | if (rc >= 0) { | 982 | if (rc < 0) |
574 | if (coredev->mode == DEVICE_MODE_NONE) { | 983 | goto exit_fw_download; |
575 | struct SmsMsgData_ST *TriggerMsg = | 984 | |
576 | (struct SmsMsgData_ST *) msg; | 985 | sms_err("sending MSG_SMS_DATA_VALIDITY_REQ expecting 0x%x", |
577 | 986 | calc_checksum); | |
578 | SMS_INIT_MSG(msg, MSG_SMS_SWDOWNLOAD_TRIGGER_REQ, | 987 | SMS_INIT_MSG(&msg->x_msg_header, MSG_SMS_DATA_VALIDITY_REQ, |
579 | sizeof(struct SmsMsgHdr_ST) + | 988 | sizeof(msg->x_msg_header) + |
580 | sizeof(u32) * 5); | 989 | sizeof(u32) * 3); |
581 | 990 | msg->msg_data[0] = firmware->start_address; | |
582 | TriggerMsg->msgData[0] = firmware->StartAddress; | 991 | /* Entry point */ |
583 | /* Entry point */ | 992 | msg->msg_data[1] = firmware->length; |
584 | TriggerMsg->msgData[1] = 5; /* Priority */ | 993 | msg->msg_data[2] = 0; /* Regular checksum*/ |
585 | TriggerMsg->msgData[2] = 0x200; /* Stack size */ | 994 | rc = smscore_sendrequest_and_wait(coredev, msg, |
586 | TriggerMsg->msgData[3] = 0; /* Parameter */ | 995 | msg->x_msg_header.msg_length, |
587 | TriggerMsg->msgData[4] = 4; /* Task ID */ | 996 | &coredev->data_validity_done); |
588 | 997 | if (rc < 0) | |
589 | if (coredev->device_flags & SMS_ROM_NO_RESPONSE) { | 998 | goto exit_fw_download; |
590 | rc = coredev->sendrequest_handler( | 999 | |
591 | coredev->context, TriggerMsg, | 1000 | if (coredev->mode == DEVICE_MODE_NONE) { |
592 | TriggerMsg->xMsgHeader.msgLength); | 1001 | struct sms_msg_data *trigger_msg = |
593 | msleep(100); | 1002 | (struct sms_msg_data *) msg; |
594 | } else | 1003 | |
595 | rc = smscore_sendrequest_and_wait( | 1004 | sms_debug("sending MSG_SMS_SWDOWNLOAD_TRIGGER_REQ"); |
596 | coredev, TriggerMsg, | 1005 | SMS_INIT_MSG(&msg->x_msg_header, |
597 | TriggerMsg->xMsgHeader.msgLength, | 1006 | MSG_SMS_SWDOWNLOAD_TRIGGER_REQ, |
1007 | sizeof(struct sms_msg_hdr) + | ||
1008 | sizeof(u32) * 5); | ||
1009 | |||
1010 | trigger_msg->msg_data[0] = firmware->start_address; | ||
1011 | /* Entry point */ | ||
1012 | trigger_msg->msg_data[1] = 6; /* Priority */ | ||
1013 | trigger_msg->msg_data[2] = 0x200; /* Stack size */ | ||
1014 | trigger_msg->msg_data[3] = 0; /* Parameter */ | ||
1015 | trigger_msg->msg_data[4] = 4; /* Task ID */ | ||
1016 | |||
1017 | rc = smscore_sendrequest_and_wait(coredev, trigger_msg, | ||
1018 | trigger_msg->x_msg_header.msg_length, | ||
598 | &coredev->trigger_done); | 1019 | &coredev->trigger_done); |
599 | } else { | 1020 | } else { |
600 | SMS_INIT_MSG(msg, MSG_SW_RELOAD_EXEC_REQ, | 1021 | SMS_INIT_MSG(&msg->x_msg_header, MSG_SW_RELOAD_EXEC_REQ, |
601 | sizeof(struct SmsMsgHdr_ST)); | 1022 | sizeof(struct sms_msg_hdr)); |
602 | 1023 | rc = coredev->sendrequest_handler(coredev->context, msg, | |
603 | rc = coredev->sendrequest_handler(coredev->context, | 1024 | msg->x_msg_header.msg_length); |
604 | msg, msg->msgLength); | ||
605 | } | ||
606 | msleep(500); | ||
607 | } | 1025 | } |
608 | 1026 | ||
609 | sms_debug("rc=%d, postload=%p ", rc, | 1027 | if (rc < 0) |
610 | coredev->postload_handler); | 1028 | goto exit_fw_download; |
1029 | |||
1030 | /* | ||
1031 | * backward compatibility - wait to device_ready_done for | ||
1032 | * not more than 400 ms | ||
1033 | */ | ||
1034 | msleep(400); | ||
611 | 1035 | ||
1036 | exit_fw_download: | ||
612 | kfree(msg); | 1037 | kfree(msg); |
613 | 1038 | ||
614 | return ((rc >= 0) && coredev->postload_handler) ? | 1039 | if (coredev->postload_handler) { |
615 | coredev->postload_handler(coredev->context) : | 1040 | sms_debug("rc=%d, postload=0x%p", rc, coredev->postload_handler); |
616 | rc; | 1041 | if (rc >= 0) |
1042 | return coredev->postload_handler(coredev->context); | ||
1043 | } | ||
1044 | |||
1045 | sms_debug("rc=%d", rc); | ||
1046 | return rc; | ||
1047 | } | ||
1048 | |||
1049 | static char *smscore_fw_lkup[][DEVICE_MODE_MAX] = { | ||
1050 | [SMS_NOVA_A0] = { | ||
1051 | [DEVICE_MODE_DVBT] = SMS_FW_DVB_NOVA_12MHZ, | ||
1052 | [DEVICE_MODE_DVBH] = SMS_FW_DVB_NOVA_12MHZ, | ||
1053 | [DEVICE_MODE_DAB_TDMB] = SMS_FW_TDMB_NOVA_12MHZ, | ||
1054 | [DEVICE_MODE_DVBT_BDA] = SMS_FW_DVB_NOVA_12MHZ, | ||
1055 | [DEVICE_MODE_ISDBT] = SMS_FW_ISDBT_NOVA_12MHZ, | ||
1056 | [DEVICE_MODE_ISDBT_BDA] = SMS_FW_ISDBT_NOVA_12MHZ, | ||
1057 | }, | ||
1058 | [SMS_NOVA_B0] = { | ||
1059 | [DEVICE_MODE_DVBT] = SMS_FW_DVB_NOVA_12MHZ_B0, | ||
1060 | [DEVICE_MODE_DVBH] = SMS_FW_DVB_NOVA_12MHZ_B0, | ||
1061 | [DEVICE_MODE_DAB_TDMB] = SMS_FW_TDMB_NOVA_12MHZ_B0, | ||
1062 | [DEVICE_MODE_DVBT_BDA] = SMS_FW_DVB_NOVA_12MHZ_B0, | ||
1063 | [DEVICE_MODE_ISDBT] = SMS_FW_ISDBT_NOVA_12MHZ_B0, | ||
1064 | [DEVICE_MODE_ISDBT_BDA] = SMS_FW_ISDBT_NOVA_12MHZ_B0, | ||
1065 | [DEVICE_MODE_FM_RADIO] = SMS_FW_FM_RADIO, | ||
1066 | [DEVICE_MODE_FM_RADIO_BDA] = SMS_FW_FM_RADIO, | ||
1067 | }, | ||
1068 | [SMS_VEGA] = { | ||
1069 | [DEVICE_MODE_CMMB] = SMS_FW_CMMB_VEGA_12MHZ, | ||
1070 | }, | ||
1071 | [SMS_VENICE] = { | ||
1072 | [DEVICE_MODE_CMMB] = SMS_FW_CMMB_VENICE_12MHZ, | ||
1073 | }, | ||
1074 | [SMS_MING] = { | ||
1075 | [DEVICE_MODE_CMMB] = SMS_FW_CMMB_MING_APP, | ||
1076 | }, | ||
1077 | [SMS_PELE] = { | ||
1078 | [DEVICE_MODE_ISDBT] = SMS_FW_ISDBT_PELE, | ||
1079 | [DEVICE_MODE_ISDBT_BDA] = SMS_FW_ISDBT_PELE, | ||
1080 | }, | ||
1081 | [SMS_RIO] = { | ||
1082 | [DEVICE_MODE_DVBT] = SMS_FW_DVB_RIO, | ||
1083 | [DEVICE_MODE_DVBH] = SMS_FW_DVBH_RIO, | ||
1084 | [DEVICE_MODE_DVBT_BDA] = SMS_FW_DVB_RIO, | ||
1085 | [DEVICE_MODE_ISDBT] = SMS_FW_ISDBT_RIO, | ||
1086 | [DEVICE_MODE_ISDBT_BDA] = SMS_FW_ISDBT_RIO, | ||
1087 | [DEVICE_MODE_FM_RADIO] = SMS_FW_FM_RADIO_RIO, | ||
1088 | [DEVICE_MODE_FM_RADIO_BDA] = SMS_FW_FM_RADIO_RIO, | ||
1089 | }, | ||
1090 | [SMS_DENVER_1530] = { | ||
1091 | [DEVICE_MODE_ATSC] = SMS_FW_ATSC_DENVER, | ||
1092 | }, | ||
1093 | [SMS_DENVER_2160] = { | ||
1094 | [DEVICE_MODE_DAB_TDMB] = SMS_FW_TDMB_DENVER, | ||
1095 | }, | ||
1096 | }; | ||
1097 | |||
1098 | /** | ||
1099 | * get firmware file name from one of the two mechanisms : sms_boards or | ||
1100 | * smscore_fw_lkup. | ||
1101 | * @param coredev pointer to a coredev object returned by | ||
1102 | * smscore_register_device | ||
1103 | * @param mode requested mode of operation | ||
1104 | * @param lookup if 1, always get the fw filename from smscore_fw_lkup | ||
1105 | * table. if 0, try first to get from sms_boards | ||
1106 | * | ||
1107 | * @return 0 on success, <0 on error. | ||
1108 | */ | ||
1109 | static char *smscore_get_fw_filename(struct smscore_device_t *coredev, | ||
1110 | int mode) | ||
1111 | { | ||
1112 | char **fw; | ||
1113 | int board_id = smscore_get_board_id(coredev); | ||
1114 | enum sms_device_type_st type; | ||
1115 | |||
1116 | type = smscore_registry_gettype(coredev->devpath); | ||
1117 | |||
1118 | /* Prevent looking outside the smscore_fw_lkup table */ | ||
1119 | if (type <= SMS_UNKNOWN_TYPE || type >= SMS_NUM_OF_DEVICE_TYPES) | ||
1120 | return NULL; | ||
1121 | if (mode <= DEVICE_MODE_NONE || mode >= DEVICE_MODE_MAX) | ||
1122 | return NULL; | ||
1123 | |||
1124 | sms_debug("trying to get fw name from sms_boards board_id %d mode %d", | ||
1125 | board_id, mode); | ||
1126 | fw = sms_get_board(board_id)->fw; | ||
1127 | if (!fw || !fw[mode]) { | ||
1128 | sms_debug("cannot find fw name in sms_boards, getting from lookup table mode %d type %d", | ||
1129 | mode, type); | ||
1130 | return smscore_fw_lkup[type][mode]; | ||
1131 | } | ||
1132 | |||
1133 | return fw[mode]; | ||
617 | } | 1134 | } |
618 | 1135 | ||
619 | /** | 1136 | /** |
@@ -627,41 +1144,46 @@ static int smscore_load_firmware_family2(struct smscore_device_t *coredev, | |||
627 | * @return 0 on success, <0 on error. | 1144 | * @return 0 on success, <0 on error. |
628 | */ | 1145 | */ |
629 | static int smscore_load_firmware_from_file(struct smscore_device_t *coredev, | 1146 | static int smscore_load_firmware_from_file(struct smscore_device_t *coredev, |
630 | char *filename, | 1147 | int mode, |
631 | loadfirmware_t loadfirmware_handler) | 1148 | loadfirmware_t loadfirmware_handler) |
632 | { | 1149 | { |
633 | int rc = -ENOENT; | 1150 | int rc = -ENOENT; |
1151 | u8 *fw_buf; | ||
1152 | u32 fw_buf_size; | ||
634 | const struct firmware *fw; | 1153 | const struct firmware *fw; |
635 | u8 *fw_buffer; | ||
636 | 1154 | ||
637 | if (loadfirmware_handler == NULL && !(coredev->device_flags & | 1155 | char *fw_filename = smscore_get_fw_filename(coredev, mode); |
638 | SMS_DEVICE_FAMILY2)) | 1156 | if (!fw_filename) { |
1157 | sms_info("mode %d not supported on this device", mode); | ||
1158 | return -ENOENT; | ||
1159 | } | ||
1160 | sms_debug("Firmware name: %s", fw_filename); | ||
1161 | |||
1162 | if (loadfirmware_handler == NULL && !(coredev->device_flags | ||
1163 | & SMS_DEVICE_FAMILY2)) | ||
639 | return -EINVAL; | 1164 | return -EINVAL; |
640 | 1165 | ||
641 | rc = request_firmware(&fw, filename, coredev->device); | 1166 | rc = request_firmware(&fw, fw_filename, coredev->device); |
642 | if (rc < 0) { | 1167 | if (rc < 0) { |
643 | sms_info("failed to open \"%s\"", filename); | 1168 | sms_info("failed to open \"%s\"", fw_filename); |
644 | return rc; | 1169 | return rc; |
645 | } | 1170 | } |
646 | sms_info("read FW %s, size=%zd", filename, fw->size); | 1171 | sms_info("read fw %s, buffer size=0x%zx", fw_filename, fw->size); |
647 | fw_buffer = kmalloc(ALIGN(fw->size, SMS_ALLOC_ALIGNMENT), | 1172 | fw_buf = kmalloc(ALIGN(fw->size, SMS_ALLOC_ALIGNMENT), |
648 | GFP_KERNEL | GFP_DMA); | 1173 | GFP_KERNEL | GFP_DMA); |
649 | if (fw_buffer) { | 1174 | if (!fw_buf) { |
650 | memcpy(fw_buffer, fw->data, fw->size); | ||
651 | |||
652 | rc = (coredev->device_flags & SMS_DEVICE_FAMILY2) ? | ||
653 | smscore_load_firmware_family2(coredev, | ||
654 | fw_buffer, | ||
655 | fw->size) : | ||
656 | loadfirmware_handler(coredev->context, | ||
657 | fw_buffer, fw->size); | ||
658 | |||
659 | kfree(fw_buffer); | ||
660 | } else { | ||
661 | sms_info("failed to allocate firmware buffer"); | 1175 | sms_info("failed to allocate firmware buffer"); |
662 | rc = -ENOMEM; | 1176 | return -ENOMEM; |
663 | } | 1177 | } |
1178 | memcpy(fw_buf, fw->data, fw->size); | ||
1179 | fw_buf_size = fw->size; | ||
1180 | |||
1181 | rc = (coredev->device_flags & SMS_DEVICE_FAMILY2) ? | ||
1182 | smscore_load_firmware_family2(coredev, fw_buf, fw_buf_size) | ||
1183 | : loadfirmware_handler(coredev->context, fw_buf, | ||
1184 | fw_buf_size); | ||
664 | 1185 | ||
1186 | kfree(fw_buf); | ||
665 | release_firmware(fw); | 1187 | release_firmware(fw); |
666 | 1188 | ||
667 | return rc; | 1189 | return rc; |
@@ -703,14 +1225,15 @@ void smscore_unregister_device(struct smscore_device_t *coredev) | |||
703 | if (num_buffers == coredev->num_buffers) | 1225 | if (num_buffers == coredev->num_buffers) |
704 | break; | 1226 | break; |
705 | if (++retry > 10) { | 1227 | if (++retry > 10) { |
706 | sms_info("exiting although " | 1228 | sms_info("exiting although not all buffers released."); |
707 | "not all buffers released."); | ||
708 | break; | 1229 | break; |
709 | } | 1230 | } |
710 | 1231 | ||
711 | sms_info("waiting for %d buffer(s)", | 1232 | sms_info("waiting for %d buffer(s)", |
712 | coredev->num_buffers - num_buffers); | 1233 | coredev->num_buffers - num_buffers); |
1234 | kmutex_unlock(&g_smscore_deviceslock); | ||
713 | msleep(100); | 1235 | msleep(100); |
1236 | kmutex_lock(&g_smscore_deviceslock); | ||
714 | } | 1237 | } |
715 | 1238 | ||
716 | sms_info("freed %d buffers", num_buffers); | 1239 | sms_info("freed %d buffers", num_buffers); |
@@ -719,8 +1242,7 @@ void smscore_unregister_device(struct smscore_device_t *coredev) | |||
719 | dma_free_coherent(NULL, coredev->common_buffer_size, | 1242 | dma_free_coherent(NULL, coredev->common_buffer_size, |
720 | coredev->common_buffer, coredev->common_buffer_phys); | 1243 | coredev->common_buffer, coredev->common_buffer_phys); |
721 | 1244 | ||
722 | if (coredev->fw_buf != NULL) | 1245 | kfree(coredev->fw_buf); |
723 | kfree(coredev->fw_buf); | ||
724 | 1246 | ||
725 | list_del(&coredev->entry); | 1247 | list_del(&coredev->entry); |
726 | kfree(coredev); | 1248 | kfree(coredev); |
@@ -733,19 +1255,19 @@ EXPORT_SYMBOL_GPL(smscore_unregister_device); | |||
733 | 1255 | ||
734 | static int smscore_detect_mode(struct smscore_device_t *coredev) | 1256 | static int smscore_detect_mode(struct smscore_device_t *coredev) |
735 | { | 1257 | { |
736 | void *buffer = kmalloc(sizeof(struct SmsMsgHdr_ST) + SMS_DMA_ALIGNMENT, | 1258 | void *buffer = kmalloc(sizeof(struct sms_msg_hdr) + SMS_DMA_ALIGNMENT, |
737 | GFP_KERNEL | GFP_DMA); | 1259 | GFP_KERNEL | GFP_DMA); |
738 | struct SmsMsgHdr_ST *msg = | 1260 | struct sms_msg_hdr *msg = |
739 | (struct SmsMsgHdr_ST *) SMS_ALIGN_ADDRESS(buffer); | 1261 | (struct sms_msg_hdr *) SMS_ALIGN_ADDRESS(buffer); |
740 | int rc; | 1262 | int rc; |
741 | 1263 | ||
742 | if (!buffer) | 1264 | if (!buffer) |
743 | return -ENOMEM; | 1265 | return -ENOMEM; |
744 | 1266 | ||
745 | SMS_INIT_MSG(msg, MSG_SMS_GET_VERSION_EX_REQ, | 1267 | SMS_INIT_MSG(msg, MSG_SMS_GET_VERSION_EX_REQ, |
746 | sizeof(struct SmsMsgHdr_ST)); | 1268 | sizeof(struct sms_msg_hdr)); |
747 | 1269 | ||
748 | rc = smscore_sendrequest_and_wait(coredev, msg, msg->msgLength, | 1270 | rc = smscore_sendrequest_and_wait(coredev, msg, msg->msg_length, |
749 | &coredev->version_ex_done); | 1271 | &coredev->version_ex_done); |
750 | if (rc == -ETIME) { | 1272 | if (rc == -ETIME) { |
751 | sms_err("MSG_SMS_GET_VERSION_EX_REQ failed first try"); | 1273 | sms_err("MSG_SMS_GET_VERSION_EX_REQ failed first try"); |
@@ -753,11 +1275,11 @@ static int smscore_detect_mode(struct smscore_device_t *coredev) | |||
753 | if (wait_for_completion_timeout(&coredev->resume_done, | 1275 | if (wait_for_completion_timeout(&coredev->resume_done, |
754 | msecs_to_jiffies(5000))) { | 1276 | msecs_to_jiffies(5000))) { |
755 | rc = smscore_sendrequest_and_wait( | 1277 | rc = smscore_sendrequest_and_wait( |
756 | coredev, msg, msg->msgLength, | 1278 | coredev, msg, msg->msg_length, |
757 | &coredev->version_ex_done); | 1279 | &coredev->version_ex_done); |
758 | if (rc < 0) | 1280 | if (rc < 0) |
759 | sms_err("MSG_SMS_GET_VERSION_EX_REQ failed " | 1281 | sms_err("MSG_SMS_GET_VERSION_EX_REQ failed second try, rc %d", |
760 | "second try, rc %d", rc); | 1282 | rc); |
761 | } else | 1283 | } else |
762 | rc = -ETIME; | 1284 | rc = -ETIME; |
763 | } | 1285 | } |
@@ -767,31 +1289,39 @@ static int smscore_detect_mode(struct smscore_device_t *coredev) | |||
767 | return rc; | 1289 | return rc; |
768 | } | 1290 | } |
769 | 1291 | ||
770 | static char *smscore_fw_lkup[][SMS_NUM_OF_DEVICE_TYPES] = { | 1292 | /** |
771 | /*Stellar NOVA A0 Nova B0 VEGA*/ | 1293 | * send init device request and wait for response |
772 | /*DVBT*/ | 1294 | * |
773 | {"none", "dvb_nova_12mhz.inp", "dvb_nova_12mhz_b0.inp", "none"}, | 1295 | * @param coredev pointer to a coredev object returned by |
774 | /*DVBH*/ | 1296 | * smscore_register_device |
775 | {"none", "dvb_nova_12mhz.inp", "dvb_nova_12mhz_b0.inp", "none"}, | 1297 | * @param mode requested mode of operation |
776 | /*TDMB*/ | 1298 | * |
777 | {"none", "tdmb_nova_12mhz.inp", "tdmb_nova_12mhz_b0.inp", "none"}, | 1299 | * @return 0 on success, <0 on error. |
778 | /*DABIP*/ | 1300 | */ |
779 | {"none", "none", "none", "none"}, | 1301 | static int smscore_init_device(struct smscore_device_t *coredev, int mode) |
780 | /*BDA*/ | ||
781 | {"none", "dvb_nova_12mhz.inp", "dvb_nova_12mhz_b0.inp", "none"}, | ||
782 | /*ISDBT*/ | ||
783 | {"none", "isdbt_nova_12mhz.inp", "isdbt_nova_12mhz_b0.inp", "none"}, | ||
784 | /*ISDBTBDA*/ | ||
785 | {"none", "isdbt_nova_12mhz.inp", "isdbt_nova_12mhz_b0.inp", "none"}, | ||
786 | /*CMMB*/ | ||
787 | {"none", "none", "none", "cmmb_vega_12mhz.inp"} | ||
788 | }; | ||
789 | |||
790 | static inline char *sms_get_fw_name(struct smscore_device_t *coredev, | ||
791 | int mode, enum sms_device_type_st type) | ||
792 | { | 1302 | { |
793 | char **fw = sms_get_board(smscore_get_board_id(coredev))->fw; | 1303 | void *buffer; |
794 | return (fw && fw[mode]) ? fw[mode] : smscore_fw_lkup[mode][type]; | 1304 | struct sms_msg_data *msg; |
1305 | int rc = 0; | ||
1306 | |||
1307 | buffer = kmalloc(sizeof(struct sms_msg_data) + | ||
1308 | SMS_DMA_ALIGNMENT, GFP_KERNEL | GFP_DMA); | ||
1309 | if (!buffer) { | ||
1310 | sms_err("Could not allocate buffer for init device message."); | ||
1311 | return -ENOMEM; | ||
1312 | } | ||
1313 | |||
1314 | msg = (struct sms_msg_data *)SMS_ALIGN_ADDRESS(buffer); | ||
1315 | SMS_INIT_MSG(&msg->x_msg_header, MSG_SMS_INIT_DEVICE_REQ, | ||
1316 | sizeof(struct sms_msg_data)); | ||
1317 | msg->msg_data[0] = mode; | ||
1318 | |||
1319 | rc = smscore_sendrequest_and_wait(coredev, msg, | ||
1320 | msg->x_msg_header. msg_length, | ||
1321 | &coredev->init_device_done); | ||
1322 | |||
1323 | kfree(buffer); | ||
1324 | return rc; | ||
795 | } | 1325 | } |
796 | 1326 | ||
797 | /** | 1327 | /** |
@@ -806,13 +1336,11 @@ static inline char *sms_get_fw_name(struct smscore_device_t *coredev, | |||
806 | */ | 1336 | */ |
807 | int smscore_set_device_mode(struct smscore_device_t *coredev, int mode) | 1337 | int smscore_set_device_mode(struct smscore_device_t *coredev, int mode) |
808 | { | 1338 | { |
809 | void *buffer; | ||
810 | int rc = 0; | 1339 | int rc = 0; |
811 | enum sms_device_type_st type; | ||
812 | 1340 | ||
813 | sms_debug("set device mode to %d", mode); | 1341 | sms_debug("set device mode to %d", mode); |
814 | if (coredev->device_flags & SMS_DEVICE_FAMILY2) { | 1342 | if (coredev->device_flags & SMS_DEVICE_FAMILY2) { |
815 | if (mode < DEVICE_MODE_DVBT || mode >= DEVICE_MODE_RAW_TUNER) { | 1343 | if (mode <= DEVICE_MODE_NONE || mode >= DEVICE_MODE_MAX) { |
816 | sms_err("invalid mode specified %d", mode); | 1344 | sms_err("invalid mode specified %d", mode); |
817 | return -EINVAL; | 1345 | return -EINVAL; |
818 | } | 1346 | } |
@@ -833,58 +1361,21 @@ int smscore_set_device_mode(struct smscore_device_t *coredev, int mode) | |||
833 | } | 1361 | } |
834 | 1362 | ||
835 | if (!(coredev->modes_supported & (1 << mode))) { | 1363 | if (!(coredev->modes_supported & (1 << mode))) { |
836 | char *fw_filename; | ||
837 | |||
838 | type = smscore_registry_gettype(coredev->devpath); | ||
839 | fw_filename = sms_get_fw_name(coredev, mode, type); | ||
840 | |||
841 | rc = smscore_load_firmware_from_file(coredev, | 1364 | rc = smscore_load_firmware_from_file(coredev, |
842 | fw_filename, NULL); | 1365 | mode, NULL); |
843 | if (rc < 0) { | 1366 | if (rc >= 0) |
844 | sms_warn("error %d loading firmware: %s, " | 1367 | sms_info("firmware download success"); |
845 | "trying again with default firmware", | ||
846 | rc, fw_filename); | ||
847 | |||
848 | /* try again with the default firmware */ | ||
849 | fw_filename = smscore_fw_lkup[mode][type]; | ||
850 | rc = smscore_load_firmware_from_file(coredev, | ||
851 | fw_filename, NULL); | ||
852 | |||
853 | if (rc < 0) { | ||
854 | sms_warn("error %d loading " | ||
855 | "firmware: %s", rc, | ||
856 | fw_filename); | ||
857 | return rc; | ||
858 | } | ||
859 | } | ||
860 | sms_log("firmware download success: %s", fw_filename); | ||
861 | } else | ||
862 | sms_info("mode %d supported by running " | ||
863 | "firmware", mode); | ||
864 | |||
865 | buffer = kmalloc(sizeof(struct SmsMsgData_ST) + | ||
866 | SMS_DMA_ALIGNMENT, GFP_KERNEL | GFP_DMA); | ||
867 | if (buffer) { | ||
868 | struct SmsMsgData_ST *msg = | ||
869 | (struct SmsMsgData_ST *) | ||
870 | SMS_ALIGN_ADDRESS(buffer); | ||
871 | |||
872 | SMS_INIT_MSG(&msg->xMsgHeader, MSG_SMS_INIT_DEVICE_REQ, | ||
873 | sizeof(struct SmsMsgData_ST)); | ||
874 | msg->msgData[0] = mode; | ||
875 | |||
876 | rc = smscore_sendrequest_and_wait( | ||
877 | coredev, msg, msg->xMsgHeader.msgLength, | ||
878 | &coredev->init_device_done); | ||
879 | |||
880 | kfree(buffer); | ||
881 | } else { | 1368 | } else { |
882 | sms_err("Could not allocate buffer for " | 1369 | sms_info("mode %d is already supported by running firmware", |
883 | "init device message."); | 1370 | mode); |
884 | rc = -ENOMEM; | 1371 | } |
1372 | if (coredev->fw_version >= 0x800) { | ||
1373 | rc = smscore_init_device(coredev, mode); | ||
1374 | if (rc < 0) | ||
1375 | sms_err("device init failed, rc %d.", rc); | ||
885 | } | 1376 | } |
886 | } else { | 1377 | } else { |
887 | if (mode < DEVICE_MODE_DVBT || mode > DEVICE_MODE_DVBT_BDA) { | 1378 | if (mode <= DEVICE_MODE_NONE || mode >= DEVICE_MODE_MAX) { |
888 | sms_err("invalid mode specified %d", mode); | 1379 | sms_err("invalid mode specified %d", mode); |
889 | return -EINVAL; | 1380 | return -EINVAL; |
890 | } | 1381 | } |
@@ -900,12 +1391,32 @@ int smscore_set_device_mode(struct smscore_device_t *coredev, int mode) | |||
900 | } | 1391 | } |
901 | 1392 | ||
902 | if (rc >= 0) { | 1393 | if (rc >= 0) { |
1394 | char *buffer; | ||
903 | coredev->mode = mode; | 1395 | coredev->mode = mode; |
904 | coredev->device_flags &= ~SMS_DEVICE_NOT_READY; | 1396 | coredev->device_flags &= ~SMS_DEVICE_NOT_READY; |
1397 | |||
1398 | buffer = kmalloc(sizeof(struct sms_msg_data) + | ||
1399 | SMS_DMA_ALIGNMENT, GFP_KERNEL | GFP_DMA); | ||
1400 | if (buffer) { | ||
1401 | struct sms_msg_data *msg = (struct sms_msg_data *) SMS_ALIGN_ADDRESS(buffer); | ||
1402 | |||
1403 | SMS_INIT_MSG(&msg->x_msg_header, MSG_SMS_INIT_DEVICE_REQ, | ||
1404 | sizeof(struct sms_msg_data)); | ||
1405 | msg->msg_data[0] = mode; | ||
1406 | |||
1407 | rc = smscore_sendrequest_and_wait( | ||
1408 | coredev, msg, msg->x_msg_header.msg_length, | ||
1409 | &coredev->init_device_done); | ||
1410 | |||
1411 | kfree(buffer); | ||
1412 | } | ||
905 | } | 1413 | } |
906 | 1414 | ||
907 | if (rc < 0) | 1415 | if (rc < 0) |
908 | sms_err("return error code %d.", rc); | 1416 | sms_err("return error code %d.", rc); |
1417 | else | ||
1418 | sms_debug("Success setting device mode."); | ||
1419 | |||
909 | return rc; | 1420 | return rc; |
910 | } | 1421 | } |
911 | 1422 | ||
@@ -971,7 +1482,7 @@ found: | |||
971 | */ | 1482 | */ |
972 | void smscore_onresponse(struct smscore_device_t *coredev, | 1483 | void smscore_onresponse(struct smscore_device_t *coredev, |
973 | struct smscore_buffer_t *cb) { | 1484 | struct smscore_buffer_t *cb) { |
974 | struct SmsMsgHdr_ST *phdr = (struct SmsMsgHdr_ST *) ((u8 *) cb->p | 1485 | struct sms_msg_hdr *phdr = (struct sms_msg_hdr *) ((u8 *) cb->p |
975 | + cb->offset); | 1486 | + cb->offset); |
976 | struct smscore_client_t *client; | 1487 | struct smscore_client_t *client; |
977 | int rc = -EBUSY; | 1488 | int rc = -EBUSY; |
@@ -983,7 +1494,7 @@ void smscore_onresponse(struct smscore_device_t *coredev, | |||
983 | last_sample_time = time_now; | 1494 | last_sample_time = time_now; |
984 | 1495 | ||
985 | if (time_now - last_sample_time > 10000) { | 1496 | if (time_now - last_sample_time > 10000) { |
986 | sms_debug("\ndata rate %d bytes/secs", | 1497 | sms_debug("data rate %d bytes/secs", |
987 | (int)((data_total * 1000) / | 1498 | (int)((data_total * 1000) / |
988 | (time_now - last_sample_time))); | 1499 | (time_now - last_sample_time))); |
989 | 1500 | ||
@@ -993,14 +1504,14 @@ void smscore_onresponse(struct smscore_device_t *coredev, | |||
993 | 1504 | ||
994 | data_total += cb->size; | 1505 | data_total += cb->size; |
995 | /* Do we need to re-route? */ | 1506 | /* Do we need to re-route? */ |
996 | if ((phdr->msgType == MSG_SMS_HO_PER_SLICES_IND) || | 1507 | if ((phdr->msg_type == MSG_SMS_HO_PER_SLICES_IND) || |
997 | (phdr->msgType == MSG_SMS_TRANSMISSION_IND)) { | 1508 | (phdr->msg_type == MSG_SMS_TRANSMISSION_IND)) { |
998 | if (coredev->mode == DEVICE_MODE_DVBT_BDA) | 1509 | if (coredev->mode == DEVICE_MODE_DVBT_BDA) |
999 | phdr->msgDstId = DVBT_BDA_CONTROL_MSG_ID; | 1510 | phdr->msg_dst_id = DVBT_BDA_CONTROL_MSG_ID; |
1000 | } | 1511 | } |
1001 | 1512 | ||
1002 | 1513 | ||
1003 | client = smscore_find_client(coredev, phdr->msgType, phdr->msgDstId); | 1514 | client = smscore_find_client(coredev, phdr->msg_type, phdr->msg_dst_id); |
1004 | 1515 | ||
1005 | /* If no client registered for type & id, | 1516 | /* If no client registered for type & id, |
1006 | * check for control client where type is not registered */ | 1517 | * check for control client where type is not registered */ |
@@ -1008,57 +1519,75 @@ void smscore_onresponse(struct smscore_device_t *coredev, | |||
1008 | rc = client->onresponse_handler(client->context, cb); | 1519 | rc = client->onresponse_handler(client->context, cb); |
1009 | 1520 | ||
1010 | if (rc < 0) { | 1521 | if (rc < 0) { |
1011 | switch (phdr->msgType) { | 1522 | switch (phdr->msg_type) { |
1523 | case MSG_SMS_ISDBT_TUNE_RES: | ||
1524 | break; | ||
1525 | case MSG_SMS_RF_TUNE_RES: | ||
1526 | break; | ||
1527 | case MSG_SMS_SIGNAL_DETECTED_IND: | ||
1528 | break; | ||
1529 | case MSG_SMS_NO_SIGNAL_IND: | ||
1530 | break; | ||
1531 | case MSG_SMS_SPI_INT_LINE_SET_RES: | ||
1532 | break; | ||
1533 | case MSG_SMS_INTERFACE_LOCK_IND: | ||
1534 | break; | ||
1535 | case MSG_SMS_INTERFACE_UNLOCK_IND: | ||
1536 | break; | ||
1012 | case MSG_SMS_GET_VERSION_EX_RES: | 1537 | case MSG_SMS_GET_VERSION_EX_RES: |
1013 | { | 1538 | { |
1014 | struct SmsVersionRes_ST *ver = | 1539 | struct sms_version_res *ver = |
1015 | (struct SmsVersionRes_ST *) phdr; | 1540 | (struct sms_version_res *) phdr; |
1016 | sms_debug("MSG_SMS_GET_VERSION_EX_RES " | 1541 | sms_debug("Firmware id %d prots 0x%x ver %d.%d", |
1017 | "id %d prots 0x%x ver %d.%d", | 1542 | ver->firmware_id, ver->supported_protocols, |
1018 | ver->FirmwareId, ver->SupportedProtocols, | 1543 | ver->rom_ver_major, ver->rom_ver_minor); |
1019 | ver->RomVersionMajor, ver->RomVersionMinor); | 1544 | |
1020 | 1545 | coredev->mode = ver->firmware_id == 255 ? | |
1021 | coredev->mode = ver->FirmwareId == 255 ? | 1546 | DEVICE_MODE_NONE : ver->firmware_id; |
1022 | DEVICE_MODE_NONE : ver->FirmwareId; | 1547 | coredev->modes_supported = ver->supported_protocols; |
1023 | coredev->modes_supported = ver->SupportedProtocols; | 1548 | coredev->fw_version = ver->rom_ver_major << 8 | |
1549 | ver->rom_ver_minor; | ||
1024 | 1550 | ||
1025 | complete(&coredev->version_ex_done); | 1551 | complete(&coredev->version_ex_done); |
1026 | break; | 1552 | break; |
1027 | } | 1553 | } |
1028 | case MSG_SMS_INIT_DEVICE_RES: | 1554 | case MSG_SMS_INIT_DEVICE_RES: |
1029 | sms_debug("MSG_SMS_INIT_DEVICE_RES"); | ||
1030 | complete(&coredev->init_device_done); | 1555 | complete(&coredev->init_device_done); |
1031 | break; | 1556 | break; |
1032 | case MSG_SW_RELOAD_START_RES: | 1557 | case MSG_SW_RELOAD_START_RES: |
1033 | sms_debug("MSG_SW_RELOAD_START_RES"); | ||
1034 | complete(&coredev->reload_start_done); | 1558 | complete(&coredev->reload_start_done); |
1035 | break; | 1559 | break; |
1560 | case MSG_SMS_DATA_VALIDITY_RES: | ||
1561 | { | ||
1562 | struct sms_msg_data *validity = (struct sms_msg_data *) phdr; | ||
1563 | |||
1564 | sms_err("MSG_SMS_DATA_VALIDITY_RES, checksum = 0x%x", | ||
1565 | validity->msg_data[0]); | ||
1566 | complete(&coredev->data_validity_done); | ||
1567 | break; | ||
1568 | } | ||
1036 | case MSG_SMS_DATA_DOWNLOAD_RES: | 1569 | case MSG_SMS_DATA_DOWNLOAD_RES: |
1037 | complete(&coredev->data_download_done); | 1570 | complete(&coredev->data_download_done); |
1038 | break; | 1571 | break; |
1039 | case MSG_SW_RELOAD_EXEC_RES: | 1572 | case MSG_SW_RELOAD_EXEC_RES: |
1040 | sms_debug("MSG_SW_RELOAD_EXEC_RES"); | ||
1041 | break; | 1573 | break; |
1042 | case MSG_SMS_SWDOWNLOAD_TRIGGER_RES: | 1574 | case MSG_SMS_SWDOWNLOAD_TRIGGER_RES: |
1043 | sms_debug("MSG_SMS_SWDOWNLOAD_TRIGGER_RES"); | ||
1044 | complete(&coredev->trigger_done); | 1575 | complete(&coredev->trigger_done); |
1045 | break; | 1576 | break; |
1046 | case MSG_SMS_SLEEP_RESUME_COMP_IND: | 1577 | case MSG_SMS_SLEEP_RESUME_COMP_IND: |
1047 | complete(&coredev->resume_done); | 1578 | complete(&coredev->resume_done); |
1048 | break; | 1579 | break; |
1049 | case MSG_SMS_GPIO_CONFIG_EX_RES: | 1580 | case MSG_SMS_GPIO_CONFIG_EX_RES: |
1050 | sms_debug("MSG_SMS_GPIO_CONFIG_EX_RES"); | ||
1051 | complete(&coredev->gpio_configuration_done); | 1581 | complete(&coredev->gpio_configuration_done); |
1052 | break; | 1582 | break; |
1053 | case MSG_SMS_GPIO_SET_LEVEL_RES: | 1583 | case MSG_SMS_GPIO_SET_LEVEL_RES: |
1054 | sms_debug("MSG_SMS_GPIO_SET_LEVEL_RES"); | ||
1055 | complete(&coredev->gpio_set_level_done); | 1584 | complete(&coredev->gpio_set_level_done); |
1056 | break; | 1585 | break; |
1057 | case MSG_SMS_GPIO_GET_LEVEL_RES: | 1586 | case MSG_SMS_GPIO_GET_LEVEL_RES: |
1058 | { | 1587 | { |
1059 | u32 *msgdata = (u32 *) phdr; | 1588 | u32 *msgdata = (u32 *) phdr; |
1060 | coredev->gpio_get_res = msgdata[1]; | 1589 | coredev->gpio_get_res = msgdata[1]; |
1061 | sms_debug("MSG_SMS_GPIO_GET_LEVEL_RES gpio level %d", | 1590 | sms_debug("gpio level %d", |
1062 | coredev->gpio_get_res); | 1591 | coredev->gpio_get_res); |
1063 | complete(&coredev->gpio_get_level_done); | 1592 | complete(&coredev->gpio_get_level_done); |
1064 | break; | 1593 | break; |
@@ -1070,12 +1599,24 @@ void smscore_onresponse(struct smscore_device_t *coredev, | |||
1070 | sms_ir_event(coredev, | 1599 | sms_ir_event(coredev, |
1071 | (const char *) | 1600 | (const char *) |
1072 | ((char *)phdr | 1601 | ((char *)phdr |
1073 | + sizeof(struct SmsMsgHdr_ST)), | 1602 | + sizeof(struct sms_msg_hdr)), |
1074 | (int)phdr->msgLength | 1603 | (int)phdr->msg_length |
1075 | - sizeof(struct SmsMsgHdr_ST)); | 1604 | - sizeof(struct sms_msg_hdr)); |
1605 | break; | ||
1606 | |||
1607 | case MSG_SMS_DVBT_BDA_DATA: | ||
1608 | /* | ||
1609 | * It can be received here, if the frontend is | ||
1610 | * tuned into a valid channel and the proper firmware | ||
1611 | * is loaded. That happens when the module got removed | ||
1612 | * and re-inserted, without powering the device off | ||
1613 | */ | ||
1076 | break; | 1614 | break; |
1077 | 1615 | ||
1078 | default: | 1616 | default: |
1617 | sms_debug("message %s(%d) not handled.", | ||
1618 | smscore_translate_msg(phdr->msg_type), | ||
1619 | phdr->msg_type); | ||
1079 | break; | 1620 | break; |
1080 | } | 1621 | } |
1081 | smscore_putbuffer(coredev, cb); | 1622 | smscore_putbuffer(coredev, cb); |
@@ -1257,7 +1798,7 @@ int smsclient_sendrequest(struct smscore_client_t *client, | |||
1257 | void *buffer, size_t size) | 1798 | void *buffer, size_t size) |
1258 | { | 1799 | { |
1259 | struct smscore_device_t *coredev; | 1800 | struct smscore_device_t *coredev; |
1260 | struct SmsMsgHdr_ST *phdr = (struct SmsMsgHdr_ST *) buffer; | 1801 | struct sms_msg_hdr *phdr = (struct sms_msg_hdr *) buffer; |
1261 | int rc; | 1802 | int rc; |
1262 | 1803 | ||
1263 | if (client == NULL) { | 1804 | if (client == NULL) { |
@@ -1274,7 +1815,7 @@ int smsclient_sendrequest(struct smscore_client_t *client, | |||
1274 | } | 1815 | } |
1275 | 1816 | ||
1276 | rc = smscore_validate_client(client->coredev, client, 0, | 1817 | rc = smscore_validate_client(client->coredev, client, 0, |
1277 | phdr->msgSrcId); | 1818 | phdr->msg_src_id); |
1278 | if (rc < 0) | 1819 | if (rc < 0) |
1279 | return rc; | 1820 | return rc; |
1280 | 1821 | ||
@@ -1288,16 +1829,16 @@ int smscore_configure_gpio(struct smscore_device_t *coredev, u32 pin, | |||
1288 | struct smscore_config_gpio *pinconfig) | 1829 | struct smscore_config_gpio *pinconfig) |
1289 | { | 1830 | { |
1290 | struct { | 1831 | struct { |
1291 | struct SmsMsgHdr_ST hdr; | 1832 | struct sms_msg_hdr hdr; |
1292 | u32 data[6]; | 1833 | u32 data[6]; |
1293 | } msg; | 1834 | } msg; |
1294 | 1835 | ||
1295 | if (coredev->device_flags & SMS_DEVICE_FAMILY2) { | 1836 | if (coredev->device_flags & SMS_DEVICE_FAMILY2) { |
1296 | msg.hdr.msgSrcId = DVBT_BDA_CONTROL_MSG_ID; | 1837 | msg.hdr.msg_src_id = DVBT_BDA_CONTROL_MSG_ID; |
1297 | msg.hdr.msgDstId = HIF_TASK; | 1838 | msg.hdr.msg_dst_id = HIF_TASK; |
1298 | msg.hdr.msgFlags = 0; | 1839 | msg.hdr.msg_flags = 0; |
1299 | msg.hdr.msgType = MSG_SMS_GPIO_CONFIG_EX_REQ; | 1840 | msg.hdr.msg_type = MSG_SMS_GPIO_CONFIG_EX_REQ; |
1300 | msg.hdr.msgLength = sizeof(msg); | 1841 | msg.hdr.msg_length = sizeof(msg); |
1301 | 1842 | ||
1302 | msg.data[0] = pin; | 1843 | msg.data[0] = pin; |
1303 | msg.data[1] = pinconfig->pullupdown; | 1844 | msg.data[1] = pinconfig->pullupdown; |
@@ -1306,16 +1847,16 @@ int smscore_configure_gpio(struct smscore_device_t *coredev, u32 pin, | |||
1306 | msg.data[2] = pinconfig->outputslewrate == 0 ? 3 : 0; | 1847 | msg.data[2] = pinconfig->outputslewrate == 0 ? 3 : 0; |
1307 | 1848 | ||
1308 | switch (pinconfig->outputdriving) { | 1849 | switch (pinconfig->outputdriving) { |
1309 | case SMS_GPIO_OUTPUTDRIVING_16mA: | 1850 | case SMS_GPIO_OUTPUTDRIVING_S_16mA: |
1310 | msg.data[3] = 7; /* Nova - 16mA */ | 1851 | msg.data[3] = 7; /* Nova - 16mA */ |
1311 | break; | 1852 | break; |
1312 | case SMS_GPIO_OUTPUTDRIVING_12mA: | 1853 | case SMS_GPIO_OUTPUTDRIVING_S_12mA: |
1313 | msg.data[3] = 5; /* Nova - 11mA */ | 1854 | msg.data[3] = 5; /* Nova - 11mA */ |
1314 | break; | 1855 | break; |
1315 | case SMS_GPIO_OUTPUTDRIVING_8mA: | 1856 | case SMS_GPIO_OUTPUTDRIVING_S_8mA: |
1316 | msg.data[3] = 3; /* Nova - 7mA */ | 1857 | msg.data[3] = 3; /* Nova - 7mA */ |
1317 | break; | 1858 | break; |
1318 | case SMS_GPIO_OUTPUTDRIVING_4mA: | 1859 | case SMS_GPIO_OUTPUTDRIVING_S_4mA: |
1319 | default: | 1860 | default: |
1320 | msg.data[3] = 2; /* Nova - 4mA */ | 1861 | msg.data[3] = 2; /* Nova - 4mA */ |
1321 | break; | 1862 | break; |
@@ -1333,18 +1874,18 @@ int smscore_configure_gpio(struct smscore_device_t *coredev, u32 pin, | |||
1333 | int smscore_set_gpio(struct smscore_device_t *coredev, u32 pin, int level) | 1874 | int smscore_set_gpio(struct smscore_device_t *coredev, u32 pin, int level) |
1334 | { | 1875 | { |
1335 | struct { | 1876 | struct { |
1336 | struct SmsMsgHdr_ST hdr; | 1877 | struct sms_msg_hdr hdr; |
1337 | u32 data[3]; | 1878 | u32 data[3]; |
1338 | } msg; | 1879 | } msg; |
1339 | 1880 | ||
1340 | if (pin > MAX_GPIO_PIN_NUMBER) | 1881 | if (pin > MAX_GPIO_PIN_NUMBER) |
1341 | return -EINVAL; | 1882 | return -EINVAL; |
1342 | 1883 | ||
1343 | msg.hdr.msgSrcId = DVBT_BDA_CONTROL_MSG_ID; | 1884 | msg.hdr.msg_src_id = DVBT_BDA_CONTROL_MSG_ID; |
1344 | msg.hdr.msgDstId = HIF_TASK; | 1885 | msg.hdr.msg_dst_id = HIF_TASK; |
1345 | msg.hdr.msgFlags = 0; | 1886 | msg.hdr.msg_flags = 0; |
1346 | msg.hdr.msgType = MSG_SMS_GPIO_SET_LEVEL_REQ; | 1887 | msg.hdr.msg_type = MSG_SMS_GPIO_SET_LEVEL_REQ; |
1347 | msg.hdr.msgLength = sizeof(msg); | 1888 | msg.hdr.msg_length = sizeof(msg); |
1348 | 1889 | ||
1349 | msg.data[0] = pin; | 1890 | msg.data[0] = pin; |
1350 | msg.data[1] = level ? 1 : 0; | 1891 | msg.data[1] = level ? 1 : 0; |
@@ -1355,122 +1896,121 @@ int smscore_set_gpio(struct smscore_device_t *coredev, u32 pin, int level) | |||
1355 | } | 1896 | } |
1356 | 1897 | ||
1357 | /* new GPIO management implementation */ | 1898 | /* new GPIO management implementation */ |
1358 | static int GetGpioPinParams(u32 PinNum, u32 *pTranslatedPinNum, | 1899 | static int get_gpio_pin_params(u32 pin_num, u32 *p_translatedpin_num, |
1359 | u32 *pGroupNum, u32 *pGroupCfg) { | 1900 | u32 *p_group_num, u32 *p_group_cfg) { |
1360 | 1901 | ||
1361 | *pGroupCfg = 1; | 1902 | *p_group_cfg = 1; |
1362 | 1903 | ||
1363 | if (PinNum <= 1) { | 1904 | if (pin_num <= 1) { |
1364 | *pTranslatedPinNum = 0; | 1905 | *p_translatedpin_num = 0; |
1365 | *pGroupNum = 9; | 1906 | *p_group_num = 9; |
1366 | *pGroupCfg = 2; | 1907 | *p_group_cfg = 2; |
1367 | } else if (PinNum >= 2 && PinNum <= 6) { | 1908 | } else if (pin_num >= 2 && pin_num <= 6) { |
1368 | *pTranslatedPinNum = 2; | 1909 | *p_translatedpin_num = 2; |
1369 | *pGroupNum = 0; | 1910 | *p_group_num = 0; |
1370 | *pGroupCfg = 2; | 1911 | *p_group_cfg = 2; |
1371 | } else if (PinNum >= 7 && PinNum <= 11) { | 1912 | } else if (pin_num >= 7 && pin_num <= 11) { |
1372 | *pTranslatedPinNum = 7; | 1913 | *p_translatedpin_num = 7; |
1373 | *pGroupNum = 1; | 1914 | *p_group_num = 1; |
1374 | } else if (PinNum >= 12 && PinNum <= 15) { | 1915 | } else if (pin_num >= 12 && pin_num <= 15) { |
1375 | *pTranslatedPinNum = 12; | 1916 | *p_translatedpin_num = 12; |
1376 | *pGroupNum = 2; | 1917 | *p_group_num = 2; |
1377 | *pGroupCfg = 3; | 1918 | *p_group_cfg = 3; |
1378 | } else if (PinNum == 16) { | 1919 | } else if (pin_num == 16) { |
1379 | *pTranslatedPinNum = 16; | 1920 | *p_translatedpin_num = 16; |
1380 | *pGroupNum = 23; | 1921 | *p_group_num = 23; |
1381 | } else if (PinNum >= 17 && PinNum <= 24) { | 1922 | } else if (pin_num >= 17 && pin_num <= 24) { |
1382 | *pTranslatedPinNum = 17; | 1923 | *p_translatedpin_num = 17; |
1383 | *pGroupNum = 3; | 1924 | *p_group_num = 3; |
1384 | } else if (PinNum == 25) { | 1925 | } else if (pin_num == 25) { |
1385 | *pTranslatedPinNum = 25; | 1926 | *p_translatedpin_num = 25; |
1386 | *pGroupNum = 6; | 1927 | *p_group_num = 6; |
1387 | } else if (PinNum >= 26 && PinNum <= 28) { | 1928 | } else if (pin_num >= 26 && pin_num <= 28) { |
1388 | *pTranslatedPinNum = 26; | 1929 | *p_translatedpin_num = 26; |
1389 | *pGroupNum = 4; | 1930 | *p_group_num = 4; |
1390 | } else if (PinNum == 29) { | 1931 | } else if (pin_num == 29) { |
1391 | *pTranslatedPinNum = 29; | 1932 | *p_translatedpin_num = 29; |
1392 | *pGroupNum = 5; | 1933 | *p_group_num = 5; |
1393 | *pGroupCfg = 2; | 1934 | *p_group_cfg = 2; |
1394 | } else if (PinNum == 30) { | 1935 | } else if (pin_num == 30) { |
1395 | *pTranslatedPinNum = 30; | 1936 | *p_translatedpin_num = 30; |
1396 | *pGroupNum = 8; | 1937 | *p_group_num = 8; |
1397 | } else if (PinNum == 31) { | 1938 | } else if (pin_num == 31) { |
1398 | *pTranslatedPinNum = 31; | 1939 | *p_translatedpin_num = 31; |
1399 | *pGroupNum = 17; | 1940 | *p_group_num = 17; |
1400 | } else | 1941 | } else |
1401 | return -1; | 1942 | return -1; |
1402 | 1943 | ||
1403 | *pGroupCfg <<= 24; | 1944 | *p_group_cfg <<= 24; |
1404 | 1945 | ||
1405 | return 0; | 1946 | return 0; |
1406 | } | 1947 | } |
1407 | 1948 | ||
1408 | int smscore_gpio_configure(struct smscore_device_t *coredev, u8 PinNum, | 1949 | int smscore_gpio_configure(struct smscore_device_t *coredev, u8 pin_num, |
1409 | struct smscore_gpio_config *pGpioConfig) { | 1950 | struct smscore_config_gpio *p_gpio_config) { |
1410 | 1951 | ||
1411 | u32 totalLen; | 1952 | u32 total_len; |
1412 | u32 TranslatedPinNum = 0; | 1953 | u32 translatedpin_num = 0; |
1413 | u32 GroupNum = 0; | 1954 | u32 group_num = 0; |
1414 | u32 ElectricChar; | 1955 | u32 electric_char; |
1415 | u32 groupCfg; | 1956 | u32 group_cfg; |
1416 | void *buffer; | 1957 | void *buffer; |
1417 | int rc; | 1958 | int rc; |
1418 | 1959 | ||
1419 | struct SetGpioMsg { | 1960 | struct set_gpio_msg { |
1420 | struct SmsMsgHdr_ST xMsgHeader; | 1961 | struct sms_msg_hdr x_msg_header; |
1421 | u32 msgData[6]; | 1962 | u32 msg_data[6]; |
1422 | } *pMsg; | 1963 | } *p_msg; |
1423 | 1964 | ||
1424 | 1965 | ||
1425 | if (PinNum > MAX_GPIO_PIN_NUMBER) | 1966 | if (pin_num > MAX_GPIO_PIN_NUMBER) |
1426 | return -EINVAL; | 1967 | return -EINVAL; |
1427 | 1968 | ||
1428 | if (pGpioConfig == NULL) | 1969 | if (p_gpio_config == NULL) |
1429 | return -EINVAL; | 1970 | return -EINVAL; |
1430 | 1971 | ||
1431 | totalLen = sizeof(struct SmsMsgHdr_ST) + (sizeof(u32) * 6); | 1972 | total_len = sizeof(struct sms_msg_hdr) + (sizeof(u32) * 6); |
1432 | 1973 | ||
1433 | buffer = kmalloc(totalLen + SMS_DMA_ALIGNMENT, | 1974 | buffer = kmalloc(total_len + SMS_DMA_ALIGNMENT, |
1434 | GFP_KERNEL | GFP_DMA); | 1975 | GFP_KERNEL | GFP_DMA); |
1435 | if (!buffer) | 1976 | if (!buffer) |
1436 | return -ENOMEM; | 1977 | return -ENOMEM; |
1437 | 1978 | ||
1438 | pMsg = (struct SetGpioMsg *) SMS_ALIGN_ADDRESS(buffer); | 1979 | p_msg = (struct set_gpio_msg *) SMS_ALIGN_ADDRESS(buffer); |
1439 | 1980 | ||
1440 | pMsg->xMsgHeader.msgSrcId = DVBT_BDA_CONTROL_MSG_ID; | 1981 | p_msg->x_msg_header.msg_src_id = DVBT_BDA_CONTROL_MSG_ID; |
1441 | pMsg->xMsgHeader.msgDstId = HIF_TASK; | 1982 | p_msg->x_msg_header.msg_dst_id = HIF_TASK; |
1442 | pMsg->xMsgHeader.msgFlags = 0; | 1983 | p_msg->x_msg_header.msg_flags = 0; |
1443 | pMsg->xMsgHeader.msgLength = (u16) totalLen; | 1984 | p_msg->x_msg_header.msg_length = (u16) total_len; |
1444 | pMsg->msgData[0] = PinNum; | 1985 | p_msg->msg_data[0] = pin_num; |
1445 | 1986 | ||
1446 | if (!(coredev->device_flags & SMS_DEVICE_FAMILY2)) { | 1987 | if (!(coredev->device_flags & SMS_DEVICE_FAMILY2)) { |
1447 | pMsg->xMsgHeader.msgType = MSG_SMS_GPIO_CONFIG_REQ; | 1988 | p_msg->x_msg_header.msg_type = MSG_SMS_GPIO_CONFIG_REQ; |
1448 | if (GetGpioPinParams(PinNum, &TranslatedPinNum, &GroupNum, | 1989 | if (get_gpio_pin_params(pin_num, &translatedpin_num, &group_num, |
1449 | &groupCfg) != 0) { | 1990 | &group_cfg) != 0) { |
1450 | rc = -EINVAL; | 1991 | rc = -EINVAL; |
1451 | goto free; | 1992 | goto free; |
1452 | } | 1993 | } |
1453 | 1994 | ||
1454 | pMsg->msgData[1] = TranslatedPinNum; | 1995 | p_msg->msg_data[1] = translatedpin_num; |
1455 | pMsg->msgData[2] = GroupNum; | 1996 | p_msg->msg_data[2] = group_num; |
1456 | ElectricChar = (pGpioConfig->PullUpDown) | 1997 | electric_char = (p_gpio_config->pullupdown) |
1457 | | (pGpioConfig->InputCharacteristics << 2) | 1998 | | (p_gpio_config->inputcharacteristics << 2) |
1458 | | (pGpioConfig->OutputSlewRate << 3) | 1999 | | (p_gpio_config->outputslewrate << 3) |
1459 | | (pGpioConfig->OutputDriving << 4); | 2000 | | (p_gpio_config->outputdriving << 4); |
1460 | pMsg->msgData[3] = ElectricChar; | 2001 | p_msg->msg_data[3] = electric_char; |
1461 | pMsg->msgData[4] = pGpioConfig->Direction; | 2002 | p_msg->msg_data[4] = p_gpio_config->direction; |
1462 | pMsg->msgData[5] = groupCfg; | 2003 | p_msg->msg_data[5] = group_cfg; |
1463 | } else { | 2004 | } else { |
1464 | pMsg->xMsgHeader.msgType = MSG_SMS_GPIO_CONFIG_EX_REQ; | 2005 | p_msg->x_msg_header.msg_type = MSG_SMS_GPIO_CONFIG_EX_REQ; |
1465 | pMsg->msgData[1] = pGpioConfig->PullUpDown; | 2006 | p_msg->msg_data[1] = p_gpio_config->pullupdown; |
1466 | pMsg->msgData[2] = pGpioConfig->OutputSlewRate; | 2007 | p_msg->msg_data[2] = p_gpio_config->outputslewrate; |
1467 | pMsg->msgData[3] = pGpioConfig->OutputDriving; | 2008 | p_msg->msg_data[3] = p_gpio_config->outputdriving; |
1468 | pMsg->msgData[4] = pGpioConfig->Direction; | 2009 | p_msg->msg_data[4] = p_gpio_config->direction; |
1469 | pMsg->msgData[5] = 0; | 2010 | p_msg->msg_data[5] = 0; |
1470 | } | 2011 | } |
1471 | 2012 | ||
1472 | smsendian_handle_tx_message((struct SmsMsgHdr_ST *)pMsg); | 2013 | rc = smscore_sendrequest_and_wait(coredev, p_msg, total_len, |
1473 | rc = smscore_sendrequest_and_wait(coredev, pMsg, totalLen, | ||
1474 | &coredev->gpio_configuration_done); | 2014 | &coredev->gpio_configuration_done); |
1475 | 2015 | ||
1476 | if (rc != 0) { | 2016 | if (rc != 0) { |
@@ -1485,42 +2025,41 @@ free: | |||
1485 | return rc; | 2025 | return rc; |
1486 | } | 2026 | } |
1487 | 2027 | ||
1488 | int smscore_gpio_set_level(struct smscore_device_t *coredev, u8 PinNum, | 2028 | int smscore_gpio_set_level(struct smscore_device_t *coredev, u8 pin_num, |
1489 | u8 NewLevel) { | 2029 | u8 new_level) { |
1490 | 2030 | ||
1491 | u32 totalLen; | 2031 | u32 total_len; |
1492 | int rc; | 2032 | int rc; |
1493 | void *buffer; | 2033 | void *buffer; |
1494 | 2034 | ||
1495 | struct SetGpioMsg { | 2035 | struct set_gpio_msg { |
1496 | struct SmsMsgHdr_ST xMsgHeader; | 2036 | struct sms_msg_hdr x_msg_header; |
1497 | u32 msgData[3]; /* keep it 3 ! */ | 2037 | u32 msg_data[3]; /* keep it 3 ! */ |
1498 | } *pMsg; | 2038 | } *p_msg; |
1499 | 2039 | ||
1500 | if ((NewLevel > 1) || (PinNum > MAX_GPIO_PIN_NUMBER)) | 2040 | if ((new_level > 1) || (pin_num > MAX_GPIO_PIN_NUMBER)) |
1501 | return -EINVAL; | 2041 | return -EINVAL; |
1502 | 2042 | ||
1503 | totalLen = sizeof(struct SmsMsgHdr_ST) + | 2043 | total_len = sizeof(struct sms_msg_hdr) + |
1504 | (3 * sizeof(u32)); /* keep it 3 ! */ | 2044 | (3 * sizeof(u32)); /* keep it 3 ! */ |
1505 | 2045 | ||
1506 | buffer = kmalloc(totalLen + SMS_DMA_ALIGNMENT, | 2046 | buffer = kmalloc(total_len + SMS_DMA_ALIGNMENT, |
1507 | GFP_KERNEL | GFP_DMA); | 2047 | GFP_KERNEL | GFP_DMA); |
1508 | if (!buffer) | 2048 | if (!buffer) |
1509 | return -ENOMEM; | 2049 | return -ENOMEM; |
1510 | 2050 | ||
1511 | pMsg = (struct SetGpioMsg *) SMS_ALIGN_ADDRESS(buffer); | 2051 | p_msg = (struct set_gpio_msg *) SMS_ALIGN_ADDRESS(buffer); |
1512 | 2052 | ||
1513 | pMsg->xMsgHeader.msgSrcId = DVBT_BDA_CONTROL_MSG_ID; | 2053 | p_msg->x_msg_header.msg_src_id = DVBT_BDA_CONTROL_MSG_ID; |
1514 | pMsg->xMsgHeader.msgDstId = HIF_TASK; | 2054 | p_msg->x_msg_header.msg_dst_id = HIF_TASK; |
1515 | pMsg->xMsgHeader.msgFlags = 0; | 2055 | p_msg->x_msg_header.msg_flags = 0; |
1516 | pMsg->xMsgHeader.msgType = MSG_SMS_GPIO_SET_LEVEL_REQ; | 2056 | p_msg->x_msg_header.msg_type = MSG_SMS_GPIO_SET_LEVEL_REQ; |
1517 | pMsg->xMsgHeader.msgLength = (u16) totalLen; | 2057 | p_msg->x_msg_header.msg_length = (u16) total_len; |
1518 | pMsg->msgData[0] = PinNum; | 2058 | p_msg->msg_data[0] = pin_num; |
1519 | pMsg->msgData[1] = NewLevel; | 2059 | p_msg->msg_data[1] = new_level; |
1520 | 2060 | ||
1521 | /* Send message to SMS */ | 2061 | /* Send message to SMS */ |
1522 | smsendian_handle_tx_message((struct SmsMsgHdr_ST *)pMsg); | 2062 | rc = smscore_sendrequest_and_wait(coredev, p_msg, total_len, |
1523 | rc = smscore_sendrequest_and_wait(coredev, pMsg, totalLen, | ||
1524 | &coredev->gpio_set_level_done); | 2063 | &coredev->gpio_set_level_done); |
1525 | 2064 | ||
1526 | if (rc != 0) { | 2065 | if (rc != 0) { |
@@ -1534,42 +2073,41 @@ int smscore_gpio_set_level(struct smscore_device_t *coredev, u8 PinNum, | |||
1534 | return rc; | 2073 | return rc; |
1535 | } | 2074 | } |
1536 | 2075 | ||
1537 | int smscore_gpio_get_level(struct smscore_device_t *coredev, u8 PinNum, | 2076 | int smscore_gpio_get_level(struct smscore_device_t *coredev, u8 pin_num, |
1538 | u8 *level) { | 2077 | u8 *level) { |
1539 | 2078 | ||
1540 | u32 totalLen; | 2079 | u32 total_len; |
1541 | int rc; | 2080 | int rc; |
1542 | void *buffer; | 2081 | void *buffer; |
1543 | 2082 | ||
1544 | struct SetGpioMsg { | 2083 | struct set_gpio_msg { |
1545 | struct SmsMsgHdr_ST xMsgHeader; | 2084 | struct sms_msg_hdr x_msg_header; |
1546 | u32 msgData[2]; | 2085 | u32 msg_data[2]; |
1547 | } *pMsg; | 2086 | } *p_msg; |
1548 | 2087 | ||
1549 | 2088 | ||
1550 | if (PinNum > MAX_GPIO_PIN_NUMBER) | 2089 | if (pin_num > MAX_GPIO_PIN_NUMBER) |
1551 | return -EINVAL; | 2090 | return -EINVAL; |
1552 | 2091 | ||
1553 | totalLen = sizeof(struct SmsMsgHdr_ST) + (2 * sizeof(u32)); | 2092 | total_len = sizeof(struct sms_msg_hdr) + (2 * sizeof(u32)); |
1554 | 2093 | ||
1555 | buffer = kmalloc(totalLen + SMS_DMA_ALIGNMENT, | 2094 | buffer = kmalloc(total_len + SMS_DMA_ALIGNMENT, |
1556 | GFP_KERNEL | GFP_DMA); | 2095 | GFP_KERNEL | GFP_DMA); |
1557 | if (!buffer) | 2096 | if (!buffer) |
1558 | return -ENOMEM; | 2097 | return -ENOMEM; |
1559 | 2098 | ||
1560 | pMsg = (struct SetGpioMsg *) SMS_ALIGN_ADDRESS(buffer); | 2099 | p_msg = (struct set_gpio_msg *) SMS_ALIGN_ADDRESS(buffer); |
1561 | 2100 | ||
1562 | pMsg->xMsgHeader.msgSrcId = DVBT_BDA_CONTROL_MSG_ID; | 2101 | p_msg->x_msg_header.msg_src_id = DVBT_BDA_CONTROL_MSG_ID; |
1563 | pMsg->xMsgHeader.msgDstId = HIF_TASK; | 2102 | p_msg->x_msg_header.msg_dst_id = HIF_TASK; |
1564 | pMsg->xMsgHeader.msgFlags = 0; | 2103 | p_msg->x_msg_header.msg_flags = 0; |
1565 | pMsg->xMsgHeader.msgType = MSG_SMS_GPIO_GET_LEVEL_REQ; | 2104 | p_msg->x_msg_header.msg_type = MSG_SMS_GPIO_GET_LEVEL_REQ; |
1566 | pMsg->xMsgHeader.msgLength = (u16) totalLen; | 2105 | p_msg->x_msg_header.msg_length = (u16) total_len; |
1567 | pMsg->msgData[0] = PinNum; | 2106 | p_msg->msg_data[0] = pin_num; |
1568 | pMsg->msgData[1] = 0; | 2107 | p_msg->msg_data[1] = 0; |
1569 | 2108 | ||
1570 | /* Send message to SMS */ | 2109 | /* Send message to SMS */ |
1571 | smsendian_handle_tx_message((struct SmsMsgHdr_ST *)pMsg); | 2110 | rc = smscore_sendrequest_and_wait(coredev, p_msg, total_len, |
1572 | rc = smscore_sendrequest_and_wait(coredev, pMsg, totalLen, | ||
1573 | &coredev->gpio_get_level_done); | 2111 | &coredev->gpio_get_level_done); |
1574 | 2112 | ||
1575 | if (rc != 0) { | 2113 | if (rc != 0) { |
@@ -1635,3 +2173,27 @@ module_exit(smscore_module_exit); | |||
1635 | MODULE_DESCRIPTION("Siano MDTV Core module"); | 2173 | MODULE_DESCRIPTION("Siano MDTV Core module"); |
1636 | MODULE_AUTHOR("Siano Mobile Silicon, Inc. (uris@siano-ms.com)"); | 2174 | MODULE_AUTHOR("Siano Mobile Silicon, Inc. (uris@siano-ms.com)"); |
1637 | MODULE_LICENSE("GPL"); | 2175 | MODULE_LICENSE("GPL"); |
2176 | |||
2177 | /* This should match what's defined at smscoreapi.h */ | ||
2178 | MODULE_FIRMWARE(SMS_FW_ATSC_DENVER); | ||
2179 | MODULE_FIRMWARE(SMS_FW_CMMB_MING_APP); | ||
2180 | MODULE_FIRMWARE(SMS_FW_CMMB_VEGA_12MHZ); | ||
2181 | MODULE_FIRMWARE(SMS_FW_CMMB_VENICE_12MHZ); | ||
2182 | MODULE_FIRMWARE(SMS_FW_DVBH_RIO); | ||
2183 | MODULE_FIRMWARE(SMS_FW_DVB_NOVA_12MHZ_B0); | ||
2184 | MODULE_FIRMWARE(SMS_FW_DVB_NOVA_12MHZ); | ||
2185 | MODULE_FIRMWARE(SMS_FW_DVB_RIO); | ||
2186 | MODULE_FIRMWARE(SMS_FW_FM_RADIO); | ||
2187 | MODULE_FIRMWARE(SMS_FW_FM_RADIO_RIO); | ||
2188 | MODULE_FIRMWARE(SMS_FW_DVBT_HCW_55XXX); | ||
2189 | MODULE_FIRMWARE(SMS_FW_ISDBT_HCW_55XXX); | ||
2190 | MODULE_FIRMWARE(SMS_FW_ISDBT_NOVA_12MHZ_B0); | ||
2191 | MODULE_FIRMWARE(SMS_FW_ISDBT_NOVA_12MHZ); | ||
2192 | MODULE_FIRMWARE(SMS_FW_ISDBT_PELE); | ||
2193 | MODULE_FIRMWARE(SMS_FW_ISDBT_RIO); | ||
2194 | MODULE_FIRMWARE(SMS_FW_DVBT_NOVA_A); | ||
2195 | MODULE_FIRMWARE(SMS_FW_DVBT_NOVA_B); | ||
2196 | MODULE_FIRMWARE(SMS_FW_DVBT_STELLAR); | ||
2197 | MODULE_FIRMWARE(SMS_FW_TDMB_DENVER); | ||
2198 | MODULE_FIRMWARE(SMS_FW_TDMB_NOVA_12MHZ_B0); | ||
2199 | MODULE_FIRMWARE(SMS_FW_TDMB_NOVA_12MHZ); | ||
diff --git a/drivers/media/common/siano/smscoreapi.h b/drivers/media/common/siano/smscoreapi.h index c592ae090397..d0799e323364 100644 --- a/drivers/media/common/siano/smscoreapi.h +++ b/drivers/media/common/siano/smscoreapi.h | |||
@@ -40,9 +40,33 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
40 | #define kmutex_trylock(_p_) mutex_trylock(_p_) | 40 | #define kmutex_trylock(_p_) mutex_trylock(_p_) |
41 | #define kmutex_unlock(_p_) mutex_unlock(_p_) | 41 | #define kmutex_unlock(_p_) mutex_unlock(_p_) |
42 | 42 | ||
43 | #ifndef min | 43 | /* |
44 | #define min(a, b) (((a) < (b)) ? (a) : (b)) | 44 | * Define the firmware names used by the driver. |
45 | #endif | 45 | * Those should match what's used at smscoreapi.c and sms-cards.c |
46 | * including the MODULE_FIRMWARE() macros at the end of smscoreapi.c | ||
47 | */ | ||
48 | #define SMS_FW_ATSC_DENVER "atsc_denver.inp" | ||
49 | #define SMS_FW_CMMB_MING_APP "cmmb_ming_app.inp" | ||
50 | #define SMS_FW_CMMB_VEGA_12MHZ "cmmb_vega_12mhz.inp" | ||
51 | #define SMS_FW_CMMB_VENICE_12MHZ "cmmb_venice_12mhz.inp" | ||
52 | #define SMS_FW_DVBH_RIO "dvbh_rio.inp" | ||
53 | #define SMS_FW_DVB_NOVA_12MHZ_B0 "dvb_nova_12mhz_b0.inp" | ||
54 | #define SMS_FW_DVB_NOVA_12MHZ "dvb_nova_12mhz.inp" | ||
55 | #define SMS_FW_DVB_RIO "dvb_rio.inp" | ||
56 | #define SMS_FW_FM_RADIO "fm_radio.inp" | ||
57 | #define SMS_FW_FM_RADIO_RIO "fm_radio_rio.inp" | ||
58 | #define SMS_FW_DVBT_HCW_55XXX "sms1xxx-hcw-55xxx-dvbt-02.fw" | ||
59 | #define SMS_FW_ISDBT_HCW_55XXX "sms1xxx-hcw-55xxx-isdbt-02.fw" | ||
60 | #define SMS_FW_ISDBT_NOVA_12MHZ_B0 "isdbt_nova_12mhz_b0.inp" | ||
61 | #define SMS_FW_ISDBT_NOVA_12MHZ "isdbt_nova_12mhz.inp" | ||
62 | #define SMS_FW_ISDBT_PELE "isdbt_pele.inp" | ||
63 | #define SMS_FW_ISDBT_RIO "isdbt_rio.inp" | ||
64 | #define SMS_FW_DVBT_NOVA_A "sms1xxx-nova-a-dvbt-01.fw" | ||
65 | #define SMS_FW_DVBT_NOVA_B "sms1xxx-nova-b-dvbt-01.fw" | ||
66 | #define SMS_FW_DVBT_STELLAR "sms1xxx-stellar-dvbt-01.fw" | ||
67 | #define SMS_FW_TDMB_DENVER "tdmb_denver.inp" | ||
68 | #define SMS_FW_TDMB_NOVA_12MHZ_B0 "tdmb_nova_12mhz_b0.inp" | ||
69 | #define SMS_FW_TDMB_NOVA_12MHZ "tdmb_nova_12mhz.inp" | ||
46 | 70 | ||
47 | #define SMS_PROTOCOL_MAX_RAOUNDTRIP_MS (10000) | 71 | #define SMS_PROTOCOL_MAX_RAOUNDTRIP_MS (10000) |
48 | #define SMS_ALLOC_ALIGNMENT 128 | 72 | #define SMS_ALLOC_ALIGNMENT 128 |
@@ -50,18 +74,31 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
50 | #define SMS_ALIGN_ADDRESS(addr) \ | 74 | #define SMS_ALIGN_ADDRESS(addr) \ |
51 | ((((uintptr_t)(addr)) + (SMS_DMA_ALIGNMENT-1)) & ~(SMS_DMA_ALIGNMENT-1)) | 75 | ((((uintptr_t)(addr)) + (SMS_DMA_ALIGNMENT-1)) & ~(SMS_DMA_ALIGNMENT-1)) |
52 | 76 | ||
77 | #define SMS_DEVICE_FAMILY1 0 | ||
53 | #define SMS_DEVICE_FAMILY2 1 | 78 | #define SMS_DEVICE_FAMILY2 1 |
54 | #define SMS_ROM_NO_RESPONSE 2 | 79 | #define SMS_ROM_NO_RESPONSE 2 |
55 | #define SMS_DEVICE_NOT_READY 0x8000000 | 80 | #define SMS_DEVICE_NOT_READY 0x8000000 |
56 | 81 | ||
57 | enum sms_device_type_st { | 82 | enum sms_device_type_st { |
83 | SMS_UNKNOWN_TYPE = -1, | ||
58 | SMS_STELLAR = 0, | 84 | SMS_STELLAR = 0, |
59 | SMS_NOVA_A0, | 85 | SMS_NOVA_A0, |
60 | SMS_NOVA_B0, | 86 | SMS_NOVA_B0, |
61 | SMS_VEGA, | 87 | SMS_VEGA, |
88 | SMS_VENICE, | ||
89 | SMS_MING, | ||
90 | SMS_PELE, | ||
91 | SMS_RIO, | ||
92 | SMS_DENVER_1530, | ||
93 | SMS_DENVER_2160, | ||
62 | SMS_NUM_OF_DEVICE_TYPES | 94 | SMS_NUM_OF_DEVICE_TYPES |
63 | }; | 95 | }; |
64 | 96 | ||
97 | enum sms_power_mode_st { | ||
98 | SMS_POWER_MODE_ACTIVE, | ||
99 | SMS_POWER_MODE_SUSPENDED | ||
100 | }; | ||
101 | |||
65 | struct smscore_device_t; | 102 | struct smscore_device_t; |
66 | struct smscore_client_t; | 103 | struct smscore_client_t; |
67 | struct smscore_buffer_t; | 104 | struct smscore_buffer_t; |
@@ -149,6 +186,7 @@ struct smscore_device_t { | |||
149 | 186 | ||
150 | /* host <--> device messages */ | 187 | /* host <--> device messages */ |
151 | struct completion version_ex_done, data_download_done, trigger_done; | 188 | struct completion version_ex_done, data_download_done, trigger_done; |
189 | struct completion data_validity_done, device_ready_done; | ||
152 | struct completion init_device_done, reload_start_done, resume_done; | 190 | struct completion init_device_done, reload_start_done, resume_done; |
153 | struct completion gpio_configuration_done, gpio_set_level_done; | 191 | struct completion gpio_configuration_done, gpio_set_level_done; |
154 | struct completion gpio_get_level_done, ir_init_done; | 192 | struct completion gpio_get_level_done, ir_init_done; |
@@ -165,10 +203,17 @@ struct smscore_device_t { | |||
165 | /* Firmware */ | 203 | /* Firmware */ |
166 | u8 *fw_buf; | 204 | u8 *fw_buf; |
167 | u32 fw_buf_size; | 205 | u32 fw_buf_size; |
206 | u16 fw_version; | ||
168 | 207 | ||
169 | /* Infrared (IR) */ | 208 | /* Infrared (IR) */ |
170 | struct ir_t ir; | 209 | struct ir_t ir; |
171 | 210 | ||
211 | /* | ||
212 | * Identify if device is USB or not. | ||
213 | * Used by smsdvb-sysfs to know the root node for debugfs | ||
214 | */ | ||
215 | bool is_usb_device; | ||
216 | |||
172 | int led_state; | 217 | int led_state; |
173 | }; | 218 | }; |
174 | 219 | ||
@@ -176,81 +221,363 @@ struct smscore_device_t { | |||
176 | #define SMS_ANTENNA_GPIO_0 1 | 221 | #define SMS_ANTENNA_GPIO_0 1 |
177 | #define SMS_ANTENNA_GPIO_1 0 | 222 | #define SMS_ANTENNA_GPIO_1 0 |
178 | 223 | ||
179 | #define BW_8_MHZ 0 | 224 | enum sms_bandwidth_mode { |
180 | #define BW_7_MHZ 1 | 225 | BW_8_MHZ = 0, |
181 | #define BW_6_MHZ 2 | 226 | BW_7_MHZ = 1, |
182 | #define BW_5_MHZ 3 | 227 | BW_6_MHZ = 2, |
183 | #define BW_ISDBT_1SEG 4 | 228 | BW_5_MHZ = 3, |
184 | #define BW_ISDBT_3SEG 5 | 229 | BW_ISDBT_1SEG = 4, |
230 | BW_ISDBT_3SEG = 5, | ||
231 | BW_2_MHZ = 6, | ||
232 | BW_FM_RADIO = 7, | ||
233 | BW_ISDBT_13SEG = 8, | ||
234 | BW_1_5_MHZ = 15, | ||
235 | BW_UNKNOWN = 0xffff | ||
236 | }; | ||
237 | |||
185 | 238 | ||
186 | #define MSG_HDR_FLAG_SPLIT_MSG 4 | 239 | #define MSG_HDR_FLAG_SPLIT_MSG 4 |
187 | 240 | ||
188 | #define MAX_GPIO_PIN_NUMBER 31 | 241 | #define MAX_GPIO_PIN_NUMBER 31 |
189 | 242 | ||
190 | #define HIF_TASK 11 | 243 | #define HIF_TASK 11 |
244 | #define HIF_TASK_SLAVE 22 | ||
245 | #define HIF_TASK_SLAVE2 33 | ||
246 | #define HIF_TASK_SLAVE3 44 | ||
191 | #define SMS_HOST_LIB 150 | 247 | #define SMS_HOST_LIB 150 |
192 | #define DVBT_BDA_CONTROL_MSG_ID 201 | 248 | #define DVBT_BDA_CONTROL_MSG_ID 201 |
193 | 249 | ||
194 | #define SMS_MAX_PAYLOAD_SIZE 240 | 250 | #define SMS_MAX_PAYLOAD_SIZE 240 |
195 | #define SMS_TUNE_TIMEOUT 500 | 251 | #define SMS_TUNE_TIMEOUT 500 |
196 | 252 | ||
197 | #define MSG_SMS_GPIO_CONFIG_REQ 507 | 253 | enum msg_types { |
198 | #define MSG_SMS_GPIO_CONFIG_RES 508 | 254 | MSG_TYPE_BASE_VAL = 500, |
199 | #define MSG_SMS_GPIO_SET_LEVEL_REQ 509 | 255 | MSG_SMS_GET_VERSION_REQ = 503, |
200 | #define MSG_SMS_GPIO_SET_LEVEL_RES 510 | 256 | MSG_SMS_GET_VERSION_RES = 504, |
201 | #define MSG_SMS_GPIO_GET_LEVEL_REQ 511 | 257 | MSG_SMS_MULTI_BRIDGE_CFG = 505, |
202 | #define MSG_SMS_GPIO_GET_LEVEL_RES 512 | 258 | MSG_SMS_GPIO_CONFIG_REQ = 507, |
203 | #define MSG_SMS_RF_TUNE_REQ 561 | 259 | MSG_SMS_GPIO_CONFIG_RES = 508, |
204 | #define MSG_SMS_RF_TUNE_RES 562 | 260 | MSG_SMS_GPIO_SET_LEVEL_REQ = 509, |
205 | #define MSG_SMS_INIT_DEVICE_REQ 578 | 261 | MSG_SMS_GPIO_SET_LEVEL_RES = 510, |
206 | #define MSG_SMS_INIT_DEVICE_RES 579 | 262 | MSG_SMS_GPIO_GET_LEVEL_REQ = 511, |
207 | #define MSG_SMS_ADD_PID_FILTER_REQ 601 | 263 | MSG_SMS_GPIO_GET_LEVEL_RES = 512, |
208 | #define MSG_SMS_ADD_PID_FILTER_RES 602 | 264 | MSG_SMS_EEPROM_BURN_IND = 513, |
209 | #define MSG_SMS_REMOVE_PID_FILTER_REQ 603 | 265 | MSG_SMS_LOG_ENABLE_CHANGE_REQ = 514, |
210 | #define MSG_SMS_REMOVE_PID_FILTER_RES 604 | 266 | MSG_SMS_LOG_ENABLE_CHANGE_RES = 515, |
211 | #define MSG_SMS_DAB_CHANNEL 607 | 267 | MSG_SMS_SET_MAX_TX_MSG_LEN_REQ = 516, |
212 | #define MSG_SMS_GET_PID_FILTER_LIST_REQ 608 | 268 | MSG_SMS_SET_MAX_TX_MSG_LEN_RES = 517, |
213 | #define MSG_SMS_GET_PID_FILTER_LIST_RES 609 | 269 | MSG_SMS_SPI_HALFDUPLEX_TOKEN_HOST_TO_DEVICE = 518, |
214 | #define MSG_SMS_GET_STATISTICS_RES 616 | 270 | MSG_SMS_SPI_HALFDUPLEX_TOKEN_DEVICE_TO_HOST = 519, |
215 | #define MSG_SMS_GET_STATISTICS_REQ 615 | 271 | MSG_SMS_BACKGROUND_SCAN_FLAG_CHANGE_REQ = 520, |
216 | #define MSG_SMS_HO_PER_SLICES_IND 630 | 272 | MSG_SMS_BACKGROUND_SCAN_FLAG_CHANGE_RES = 521, |
217 | #define MSG_SMS_SET_ANTENNA_CONFIG_REQ 651 | 273 | MSG_SMS_BACKGROUND_SCAN_SIGNAL_DETECTED_IND = 522, |
218 | #define MSG_SMS_SET_ANTENNA_CONFIG_RES 652 | 274 | MSG_SMS_BACKGROUND_SCAN_NO_SIGNAL_IND = 523, |
219 | #define MSG_SMS_SLEEP_RESUME_COMP_IND 655 | 275 | MSG_SMS_CONFIGURE_RF_SWITCH_REQ = 524, |
220 | #define MSG_SMS_DATA_DOWNLOAD_REQ 660 | 276 | MSG_SMS_CONFIGURE_RF_SWITCH_RES = 525, |
221 | #define MSG_SMS_DATA_DOWNLOAD_RES 661 | 277 | MSG_SMS_MRC_PATH_DISCONNECT_REQ = 526, |
222 | #define MSG_SMS_SWDOWNLOAD_TRIGGER_REQ 664 | 278 | MSG_SMS_MRC_PATH_DISCONNECT_RES = 527, |
223 | #define MSG_SMS_SWDOWNLOAD_TRIGGER_RES 665 | 279 | MSG_SMS_RECEIVE_1SEG_THROUGH_FULLSEG_REQ = 528, |
224 | #define MSG_SMS_SWDOWNLOAD_BACKDOOR_REQ 666 | 280 | MSG_SMS_RECEIVE_1SEG_THROUGH_FULLSEG_RES = 529, |
225 | #define MSG_SMS_SWDOWNLOAD_BACKDOOR_RES 667 | 281 | MSG_SMS_RECEIVE_VHF_VIA_VHF_INPUT_REQ = 530, |
226 | #define MSG_SMS_GET_VERSION_EX_REQ 668 | 282 | MSG_SMS_RECEIVE_VHF_VIA_VHF_INPUT_RES = 531, |
227 | #define MSG_SMS_GET_VERSION_EX_RES 669 | 283 | MSG_WR_REG_RFT_REQ = 533, |
228 | #define MSG_SMS_SET_CLOCK_OUTPUT_REQ 670 | 284 | MSG_WR_REG_RFT_RES = 534, |
229 | #define MSG_SMS_I2C_SET_FREQ_REQ 685 | 285 | MSG_RD_REG_RFT_REQ = 535, |
230 | #define MSG_SMS_GENERIC_I2C_REQ 687 | 286 | MSG_RD_REG_RFT_RES = 536, |
231 | #define MSG_SMS_GENERIC_I2C_RES 688 | 287 | MSG_RD_REG_ALL_RFT_REQ = 537, |
232 | #define MSG_SMS_DVBT_BDA_DATA 693 | 288 | MSG_RD_REG_ALL_RFT_RES = 538, |
233 | #define MSG_SW_RELOAD_REQ 697 | 289 | MSG_HELP_INT = 539, |
234 | #define MSG_SMS_DATA_MSG 699 | 290 | MSG_RUN_SCRIPT_INT = 540, |
235 | #define MSG_SW_RELOAD_START_REQ 702 | 291 | MSG_SMS_EWS_INBAND_REQ = 541, |
236 | #define MSG_SW_RELOAD_START_RES 703 | 292 | MSG_SMS_EWS_INBAND_RES = 542, |
237 | #define MSG_SW_RELOAD_EXEC_REQ 704 | 293 | MSG_SMS_RFS_SELECT_REQ = 543, |
238 | #define MSG_SW_RELOAD_EXEC_RES 705 | 294 | MSG_SMS_RFS_SELECT_RES = 544, |
239 | #define MSG_SMS_SPI_INT_LINE_SET_REQ 710 | 295 | MSG_SMS_MB_GET_VER_REQ = 545, |
240 | #define MSG_SMS_GPIO_CONFIG_EX_REQ 712 | 296 | MSG_SMS_MB_GET_VER_RES = 546, |
241 | #define MSG_SMS_GPIO_CONFIG_EX_RES 713 | 297 | MSG_SMS_MB_WRITE_CFGFILE_REQ = 547, |
242 | #define MSG_SMS_ISDBT_TUNE_REQ 776 | 298 | MSG_SMS_MB_WRITE_CFGFILE_RES = 548, |
243 | #define MSG_SMS_ISDBT_TUNE_RES 777 | 299 | MSG_SMS_MB_READ_CFGFILE_REQ = 549, |
244 | #define MSG_SMS_TRANSMISSION_IND 782 | 300 | MSG_SMS_MB_READ_CFGFILE_RES = 550, |
245 | #define MSG_SMS_START_IR_REQ 800 | 301 | MSG_SMS_RD_MEM_REQ = 552, |
246 | #define MSG_SMS_START_IR_RES 801 | 302 | MSG_SMS_RD_MEM_RES = 553, |
247 | #define MSG_SMS_IR_SAMPLES_IND 802 | 303 | MSG_SMS_WR_MEM_REQ = 554, |
248 | #define MSG_SMS_SIGNAL_DETECTED_IND 827 | 304 | MSG_SMS_WR_MEM_RES = 555, |
249 | #define MSG_SMS_NO_SIGNAL_IND 828 | 305 | MSG_SMS_UPDATE_MEM_REQ = 556, |
306 | MSG_SMS_UPDATE_MEM_RES = 557, | ||
307 | MSG_SMS_ISDBT_ENABLE_FULL_PARAMS_SET_REQ = 558, | ||
308 | MSG_SMS_ISDBT_ENABLE_FULL_PARAMS_SET_RES = 559, | ||
309 | MSG_SMS_RF_TUNE_REQ = 561, | ||
310 | MSG_SMS_RF_TUNE_RES = 562, | ||
311 | MSG_SMS_ISDBT_ENABLE_HIGH_MOBILITY_REQ = 563, | ||
312 | MSG_SMS_ISDBT_ENABLE_HIGH_MOBILITY_RES = 564, | ||
313 | MSG_SMS_ISDBT_SB_RECEPTION_REQ = 565, | ||
314 | MSG_SMS_ISDBT_SB_RECEPTION_RES = 566, | ||
315 | MSG_SMS_GENERIC_EPROM_WRITE_REQ = 567, | ||
316 | MSG_SMS_GENERIC_EPROM_WRITE_RES = 568, | ||
317 | MSG_SMS_GENERIC_EPROM_READ_REQ = 569, | ||
318 | MSG_SMS_GENERIC_EPROM_READ_RES = 570, | ||
319 | MSG_SMS_EEPROM_WRITE_REQ = 571, | ||
320 | MSG_SMS_EEPROM_WRITE_RES = 572, | ||
321 | MSG_SMS_CUSTOM_READ_REQ = 574, | ||
322 | MSG_SMS_CUSTOM_READ_RES = 575, | ||
323 | MSG_SMS_CUSTOM_WRITE_REQ = 576, | ||
324 | MSG_SMS_CUSTOM_WRITE_RES = 577, | ||
325 | MSG_SMS_INIT_DEVICE_REQ = 578, | ||
326 | MSG_SMS_INIT_DEVICE_RES = 579, | ||
327 | MSG_SMS_ATSC_SET_ALL_IP_REQ = 580, | ||
328 | MSG_SMS_ATSC_SET_ALL_IP_RES = 581, | ||
329 | MSG_SMS_ATSC_START_ENSEMBLE_REQ = 582, | ||
330 | MSG_SMS_ATSC_START_ENSEMBLE_RES = 583, | ||
331 | MSG_SMS_SET_OUTPUT_MODE_REQ = 584, | ||
332 | MSG_SMS_SET_OUTPUT_MODE_RES = 585, | ||
333 | MSG_SMS_ATSC_IP_FILTER_GET_LIST_REQ = 586, | ||
334 | MSG_SMS_ATSC_IP_FILTER_GET_LIST_RES = 587, | ||
335 | MSG_SMS_SUB_CHANNEL_START_REQ = 589, | ||
336 | MSG_SMS_SUB_CHANNEL_START_RES = 590, | ||
337 | MSG_SMS_SUB_CHANNEL_STOP_REQ = 591, | ||
338 | MSG_SMS_SUB_CHANNEL_STOP_RES = 592, | ||
339 | MSG_SMS_ATSC_IP_FILTER_ADD_REQ = 593, | ||
340 | MSG_SMS_ATSC_IP_FILTER_ADD_RES = 594, | ||
341 | MSG_SMS_ATSC_IP_FILTER_REMOVE_REQ = 595, | ||
342 | MSG_SMS_ATSC_IP_FILTER_REMOVE_RES = 596, | ||
343 | MSG_SMS_ATSC_IP_FILTER_REMOVE_ALL_REQ = 597, | ||
344 | MSG_SMS_ATSC_IP_FILTER_REMOVE_ALL_RES = 598, | ||
345 | MSG_SMS_WAIT_CMD = 599, | ||
346 | MSG_SMS_ADD_PID_FILTER_REQ = 601, | ||
347 | MSG_SMS_ADD_PID_FILTER_RES = 602, | ||
348 | MSG_SMS_REMOVE_PID_FILTER_REQ = 603, | ||
349 | MSG_SMS_REMOVE_PID_FILTER_RES = 604, | ||
350 | MSG_SMS_FAST_INFORMATION_CHANNEL_REQ = 605, | ||
351 | MSG_SMS_FAST_INFORMATION_CHANNEL_RES = 606, | ||
352 | MSG_SMS_DAB_CHANNEL = 607, | ||
353 | MSG_SMS_GET_PID_FILTER_LIST_REQ = 608, | ||
354 | MSG_SMS_GET_PID_FILTER_LIST_RES = 609, | ||
355 | MSG_SMS_POWER_DOWN_REQ = 610, | ||
356 | MSG_SMS_POWER_DOWN_RES = 611, | ||
357 | MSG_SMS_ATSC_SLT_EXIST_IND = 612, | ||
358 | MSG_SMS_ATSC_NO_SLT_IND = 613, | ||
359 | MSG_SMS_GET_STATISTICS_REQ = 615, | ||
360 | MSG_SMS_GET_STATISTICS_RES = 616, | ||
361 | MSG_SMS_SEND_DUMP = 617, | ||
362 | MSG_SMS_SCAN_START_REQ = 618, | ||
363 | MSG_SMS_SCAN_START_RES = 619, | ||
364 | MSG_SMS_SCAN_STOP_REQ = 620, | ||
365 | MSG_SMS_SCAN_STOP_RES = 621, | ||
366 | MSG_SMS_SCAN_PROGRESS_IND = 622, | ||
367 | MSG_SMS_SCAN_COMPLETE_IND = 623, | ||
368 | MSG_SMS_LOG_ITEM = 624, | ||
369 | MSG_SMS_DAB_SUBCHANNEL_RECONFIG_REQ = 628, | ||
370 | MSG_SMS_DAB_SUBCHANNEL_RECONFIG_RES = 629, | ||
371 | MSG_SMS_HO_PER_SLICES_IND = 630, | ||
372 | MSG_SMS_HO_INBAND_POWER_IND = 631, | ||
373 | MSG_SMS_MANUAL_DEMOD_REQ = 632, | ||
374 | MSG_SMS_HO_TUNE_ON_REQ = 636, | ||
375 | MSG_SMS_HO_TUNE_ON_RES = 637, | ||
376 | MSG_SMS_HO_TUNE_OFF_REQ = 638, | ||
377 | MSG_SMS_HO_TUNE_OFF_RES = 639, | ||
378 | MSG_SMS_HO_PEEK_FREQ_REQ = 640, | ||
379 | MSG_SMS_HO_PEEK_FREQ_RES = 641, | ||
380 | MSG_SMS_HO_PEEK_FREQ_IND = 642, | ||
381 | MSG_SMS_MB_ATTEN_SET_REQ = 643, | ||
382 | MSG_SMS_MB_ATTEN_SET_RES = 644, | ||
383 | MSG_SMS_ENABLE_STAT_IN_I2C_REQ = 649, | ||
384 | MSG_SMS_ENABLE_STAT_IN_I2C_RES = 650, | ||
385 | MSG_SMS_SET_ANTENNA_CONFIG_REQ = 651, | ||
386 | MSG_SMS_SET_ANTENNA_CONFIG_RES = 652, | ||
387 | MSG_SMS_GET_STATISTICS_EX_REQ = 653, | ||
388 | MSG_SMS_GET_STATISTICS_EX_RES = 654, | ||
389 | MSG_SMS_SLEEP_RESUME_COMP_IND = 655, | ||
390 | MSG_SMS_SWITCH_HOST_INTERFACE_REQ = 656, | ||
391 | MSG_SMS_SWITCH_HOST_INTERFACE_RES = 657, | ||
392 | MSG_SMS_DATA_DOWNLOAD_REQ = 660, | ||
393 | MSG_SMS_DATA_DOWNLOAD_RES = 661, | ||
394 | MSG_SMS_DATA_VALIDITY_REQ = 662, | ||
395 | MSG_SMS_DATA_VALIDITY_RES = 663, | ||
396 | MSG_SMS_SWDOWNLOAD_TRIGGER_REQ = 664, | ||
397 | MSG_SMS_SWDOWNLOAD_TRIGGER_RES = 665, | ||
398 | MSG_SMS_SWDOWNLOAD_BACKDOOR_REQ = 666, | ||
399 | MSG_SMS_SWDOWNLOAD_BACKDOOR_RES = 667, | ||
400 | MSG_SMS_GET_VERSION_EX_REQ = 668, | ||
401 | MSG_SMS_GET_VERSION_EX_RES = 669, | ||
402 | MSG_SMS_CLOCK_OUTPUT_CONFIG_REQ = 670, | ||
403 | MSG_SMS_CLOCK_OUTPUT_CONFIG_RES = 671, | ||
404 | MSG_SMS_I2C_SET_FREQ_REQ = 685, | ||
405 | MSG_SMS_I2C_SET_FREQ_RES = 686, | ||
406 | MSG_SMS_GENERIC_I2C_REQ = 687, | ||
407 | MSG_SMS_GENERIC_I2C_RES = 688, | ||
408 | MSG_SMS_DVBT_BDA_DATA = 693, | ||
409 | MSG_SW_RELOAD_REQ = 697, | ||
410 | MSG_SMS_DATA_MSG = 699, | ||
411 | MSG_TABLE_UPLOAD_REQ = 700, | ||
412 | MSG_TABLE_UPLOAD_RES = 701, | ||
413 | MSG_SW_RELOAD_START_REQ = 702, | ||
414 | MSG_SW_RELOAD_START_RES = 703, | ||
415 | MSG_SW_RELOAD_EXEC_REQ = 704, | ||
416 | MSG_SW_RELOAD_EXEC_RES = 705, | ||
417 | MSG_SMS_SPI_INT_LINE_SET_REQ = 710, | ||
418 | MSG_SMS_SPI_INT_LINE_SET_RES = 711, | ||
419 | MSG_SMS_GPIO_CONFIG_EX_REQ = 712, | ||
420 | MSG_SMS_GPIO_CONFIG_EX_RES = 713, | ||
421 | MSG_SMS_WATCHDOG_ACT_REQ = 716, | ||
422 | MSG_SMS_WATCHDOG_ACT_RES = 717, | ||
423 | MSG_SMS_LOOPBACK_REQ = 718, | ||
424 | MSG_SMS_LOOPBACK_RES = 719, | ||
425 | MSG_SMS_RAW_CAPTURE_START_REQ = 720, | ||
426 | MSG_SMS_RAW_CAPTURE_START_RES = 721, | ||
427 | MSG_SMS_RAW_CAPTURE_ABORT_REQ = 722, | ||
428 | MSG_SMS_RAW_CAPTURE_ABORT_RES = 723, | ||
429 | MSG_SMS_RAW_CAPTURE_COMPLETE_IND = 728, | ||
430 | MSG_SMS_DATA_PUMP_IND = 729, | ||
431 | MSG_SMS_DATA_PUMP_REQ = 730, | ||
432 | MSG_SMS_DATA_PUMP_RES = 731, | ||
433 | MSG_SMS_FLASH_DL_REQ = 732, | ||
434 | MSG_SMS_EXEC_TEST_1_REQ = 734, | ||
435 | MSG_SMS_EXEC_TEST_1_RES = 735, | ||
436 | MSG_SMS_ENBALE_TS_INTERFACE_REQ = 736, | ||
437 | MSG_SMS_ENBALE_TS_INTERFACE_RES = 737, | ||
438 | MSG_SMS_SPI_SET_BUS_WIDTH_REQ = 738, | ||
439 | MSG_SMS_SPI_SET_BUS_WIDTH_RES = 739, | ||
440 | MSG_SMS_SEND_EMM_REQ = 740, | ||
441 | MSG_SMS_SEND_EMM_RES = 741, | ||
442 | MSG_SMS_DISABLE_TS_INTERFACE_REQ = 742, | ||
443 | MSG_SMS_DISABLE_TS_INTERFACE_RES = 743, | ||
444 | MSG_SMS_IS_BUF_FREE_REQ = 744, | ||
445 | MSG_SMS_IS_BUF_FREE_RES = 745, | ||
446 | MSG_SMS_EXT_ANTENNA_REQ = 746, | ||
447 | MSG_SMS_EXT_ANTENNA_RES = 747, | ||
448 | MSG_SMS_CMMB_GET_NET_OF_FREQ_REQ_OBSOLETE = 748, | ||
449 | MSG_SMS_CMMB_GET_NET_OF_FREQ_RES_OBSOLETE = 749, | ||
450 | MSG_SMS_BATTERY_LEVEL_REQ = 750, | ||
451 | MSG_SMS_BATTERY_LEVEL_RES = 751, | ||
452 | MSG_SMS_CMMB_INJECT_TABLE_REQ_OBSOLETE = 752, | ||
453 | MSG_SMS_CMMB_INJECT_TABLE_RES_OBSOLETE = 753, | ||
454 | MSG_SMS_FM_RADIO_BLOCK_IND = 754, | ||
455 | MSG_SMS_HOST_NOTIFICATION_IND = 755, | ||
456 | MSG_SMS_CMMB_GET_CONTROL_TABLE_REQ_OBSOLETE = 756, | ||
457 | MSG_SMS_CMMB_GET_CONTROL_TABLE_RES_OBSOLETE = 757, | ||
458 | MSG_SMS_CMMB_GET_NETWORKS_REQ = 760, | ||
459 | MSG_SMS_CMMB_GET_NETWORKS_RES = 761, | ||
460 | MSG_SMS_CMMB_START_SERVICE_REQ = 762, | ||
461 | MSG_SMS_CMMB_START_SERVICE_RES = 763, | ||
462 | MSG_SMS_CMMB_STOP_SERVICE_REQ = 764, | ||
463 | MSG_SMS_CMMB_STOP_SERVICE_RES = 765, | ||
464 | MSG_SMS_CMMB_ADD_CHANNEL_FILTER_REQ = 768, | ||
465 | MSG_SMS_CMMB_ADD_CHANNEL_FILTER_RES = 769, | ||
466 | MSG_SMS_CMMB_REMOVE_CHANNEL_FILTER_REQ = 770, | ||
467 | MSG_SMS_CMMB_REMOVE_CHANNEL_FILTER_RES = 771, | ||
468 | MSG_SMS_CMMB_START_CONTROL_INFO_REQ = 772, | ||
469 | MSG_SMS_CMMB_START_CONTROL_INFO_RES = 773, | ||
470 | MSG_SMS_CMMB_STOP_CONTROL_INFO_REQ = 774, | ||
471 | MSG_SMS_CMMB_STOP_CONTROL_INFO_RES = 775, | ||
472 | MSG_SMS_ISDBT_TUNE_REQ = 776, | ||
473 | MSG_SMS_ISDBT_TUNE_RES = 777, | ||
474 | MSG_SMS_TRANSMISSION_IND = 782, | ||
475 | MSG_SMS_PID_STATISTICS_IND = 783, | ||
476 | MSG_SMS_POWER_DOWN_IND = 784, | ||
477 | MSG_SMS_POWER_DOWN_CONF = 785, | ||
478 | MSG_SMS_POWER_UP_IND = 786, | ||
479 | MSG_SMS_POWER_UP_CONF = 787, | ||
480 | MSG_SMS_POWER_MODE_SET_REQ = 790, | ||
481 | MSG_SMS_POWER_MODE_SET_RES = 791, | ||
482 | MSG_SMS_DEBUG_HOST_EVENT_REQ = 792, | ||
483 | MSG_SMS_DEBUG_HOST_EVENT_RES = 793, | ||
484 | MSG_SMS_NEW_CRYSTAL_REQ = 794, | ||
485 | MSG_SMS_NEW_CRYSTAL_RES = 795, | ||
486 | MSG_SMS_CONFIG_SPI_REQ = 796, | ||
487 | MSG_SMS_CONFIG_SPI_RES = 797, | ||
488 | MSG_SMS_I2C_SHORT_STAT_IND = 798, | ||
489 | MSG_SMS_START_IR_REQ = 800, | ||
490 | MSG_SMS_START_IR_RES = 801, | ||
491 | MSG_SMS_IR_SAMPLES_IND = 802, | ||
492 | MSG_SMS_CMMB_CA_SERVICE_IND = 803, | ||
493 | MSG_SMS_SLAVE_DEVICE_DETECTED = 804, | ||
494 | MSG_SMS_INTERFACE_LOCK_IND = 805, | ||
495 | MSG_SMS_INTERFACE_UNLOCK_IND = 806, | ||
496 | MSG_SMS_SEND_ROSUM_BUFF_REQ = 810, | ||
497 | MSG_SMS_SEND_ROSUM_BUFF_RES = 811, | ||
498 | MSG_SMS_ROSUM_BUFF = 812, | ||
499 | MSG_SMS_SET_AES128_KEY_REQ = 815, | ||
500 | MSG_SMS_SET_AES128_KEY_RES = 816, | ||
501 | MSG_SMS_MBBMS_WRITE_REQ = 817, | ||
502 | MSG_SMS_MBBMS_WRITE_RES = 818, | ||
503 | MSG_SMS_MBBMS_READ_IND = 819, | ||
504 | MSG_SMS_IQ_STREAM_START_REQ = 820, | ||
505 | MSG_SMS_IQ_STREAM_START_RES = 821, | ||
506 | MSG_SMS_IQ_STREAM_STOP_REQ = 822, | ||
507 | MSG_SMS_IQ_STREAM_STOP_RES = 823, | ||
508 | MSG_SMS_IQ_STREAM_DATA_BLOCK = 824, | ||
509 | MSG_SMS_GET_EEPROM_VERSION_REQ = 825, | ||
510 | MSG_SMS_GET_EEPROM_VERSION_RES = 826, | ||
511 | MSG_SMS_SIGNAL_DETECTED_IND = 827, | ||
512 | MSG_SMS_NO_SIGNAL_IND = 828, | ||
513 | MSG_SMS_MRC_SHUTDOWN_SLAVE_REQ = 830, | ||
514 | MSG_SMS_MRC_SHUTDOWN_SLAVE_RES = 831, | ||
515 | MSG_SMS_MRC_BRINGUP_SLAVE_REQ = 832, | ||
516 | MSG_SMS_MRC_BRINGUP_SLAVE_RES = 833, | ||
517 | MSG_SMS_EXTERNAL_LNA_CTRL_REQ = 834, | ||
518 | MSG_SMS_EXTERNAL_LNA_CTRL_RES = 835, | ||
519 | MSG_SMS_SET_PERIODIC_STATISTICS_REQ = 836, | ||
520 | MSG_SMS_SET_PERIODIC_STATISTICS_RES = 837, | ||
521 | MSG_SMS_CMMB_SET_AUTO_OUTPUT_TS0_REQ = 838, | ||
522 | MSG_SMS_CMMB_SET_AUTO_OUTPUT_TS0_RES = 839, | ||
523 | LOCAL_TUNE = 850, | ||
524 | LOCAL_IFFT_H_ICI = 851, | ||
525 | MSG_RESYNC_REQ = 852, | ||
526 | MSG_SMS_CMMB_GET_MRC_STATISTICS_REQ = 853, | ||
527 | MSG_SMS_CMMB_GET_MRC_STATISTICS_RES = 854, | ||
528 | MSG_SMS_LOG_EX_ITEM = 855, | ||
529 | MSG_SMS_DEVICE_DATA_LOSS_IND = 856, | ||
530 | MSG_SMS_MRC_WATCHDOG_TRIGGERED_IND = 857, | ||
531 | MSG_SMS_USER_MSG_REQ = 858, | ||
532 | MSG_SMS_USER_MSG_RES = 859, | ||
533 | MSG_SMS_SMART_CARD_INIT_REQ = 860, | ||
534 | MSG_SMS_SMART_CARD_INIT_RES = 861, | ||
535 | MSG_SMS_SMART_CARD_WRITE_REQ = 862, | ||
536 | MSG_SMS_SMART_CARD_WRITE_RES = 863, | ||
537 | MSG_SMS_SMART_CARD_READ_IND = 864, | ||
538 | MSG_SMS_TSE_ENABLE_REQ = 866, | ||
539 | MSG_SMS_TSE_ENABLE_RES = 867, | ||
540 | MSG_SMS_CMMB_GET_SHORT_STATISTICS_REQ = 868, | ||
541 | MSG_SMS_CMMB_GET_SHORT_STATISTICS_RES = 869, | ||
542 | MSG_SMS_LED_CONFIG_REQ = 870, | ||
543 | MSG_SMS_LED_CONFIG_RES = 871, | ||
544 | MSG_PWM_ANTENNA_REQ = 872, | ||
545 | MSG_PWM_ANTENNA_RES = 873, | ||
546 | MSG_SMS_CMMB_SMD_SN_REQ = 874, | ||
547 | MSG_SMS_CMMB_SMD_SN_RES = 875, | ||
548 | MSG_SMS_CMMB_SET_CA_CW_REQ = 876, | ||
549 | MSG_SMS_CMMB_SET_CA_CW_RES = 877, | ||
550 | MSG_SMS_CMMB_SET_CA_SALT_REQ = 878, | ||
551 | MSG_SMS_CMMB_SET_CA_SALT_RES = 879, | ||
552 | MSG_SMS_NSCD_INIT_REQ = 880, | ||
553 | MSG_SMS_NSCD_INIT_RES = 881, | ||
554 | MSG_SMS_NSCD_PROCESS_SECTION_REQ = 882, | ||
555 | MSG_SMS_NSCD_PROCESS_SECTION_RES = 883, | ||
556 | MSG_SMS_DBD_CREATE_OBJECT_REQ = 884, | ||
557 | MSG_SMS_DBD_CREATE_OBJECT_RES = 885, | ||
558 | MSG_SMS_DBD_CONFIGURE_REQ = 886, | ||
559 | MSG_SMS_DBD_CONFIGURE_RES = 887, | ||
560 | MSG_SMS_DBD_SET_KEYS_REQ = 888, | ||
561 | MSG_SMS_DBD_SET_KEYS_RES = 889, | ||
562 | MSG_SMS_DBD_PROCESS_HEADER_REQ = 890, | ||
563 | MSG_SMS_DBD_PROCESS_HEADER_RES = 891, | ||
564 | MSG_SMS_DBD_PROCESS_DATA_REQ = 892, | ||
565 | MSG_SMS_DBD_PROCESS_DATA_RES = 893, | ||
566 | MSG_SMS_DBD_PROCESS_GET_DATA_REQ = 894, | ||
567 | MSG_SMS_DBD_PROCESS_GET_DATA_RES = 895, | ||
568 | MSG_SMS_NSCD_OPEN_SESSION_REQ = 896, | ||
569 | MSG_SMS_NSCD_OPEN_SESSION_RES = 897, | ||
570 | MSG_SMS_SEND_HOST_DATA_TO_DEMUX_REQ = 898, | ||
571 | MSG_SMS_SEND_HOST_DATA_TO_DEMUX_RES = 899, | ||
572 | MSG_LAST_MSG_TYPE = 900, | ||
573 | }; | ||
250 | 574 | ||
251 | #define SMS_INIT_MSG_EX(ptr, type, src, dst, len) do { \ | 575 | #define SMS_INIT_MSG_EX(ptr, type, src, dst, len) do { \ |
252 | (ptr)->msgType = type; (ptr)->msgSrcId = src; (ptr)->msgDstId = dst; \ | 576 | (ptr)->msg_type = type; \ |
253 | (ptr)->msgLength = len; (ptr)->msgFlags = 0; \ | 577 | (ptr)->msg_src_id = src; \ |
578 | (ptr)->msg_dst_id = dst; \ | ||
579 | (ptr)->msg_length = len; \ | ||
580 | (ptr)->msg_flags = 0; \ | ||
254 | } while (0) | 581 | } while (0) |
255 | 582 | ||
256 | #define SMS_INIT_MSG(ptr, type, len) \ | 583 | #define SMS_INIT_MSG(ptr, type, len) \ |
@@ -277,228 +604,296 @@ enum SMS_DEVICE_MODE { | |||
277 | DEVICE_MODE_ISDBT_BDA, | 604 | DEVICE_MODE_ISDBT_BDA, |
278 | DEVICE_MODE_CMMB, | 605 | DEVICE_MODE_CMMB, |
279 | DEVICE_MODE_RAW_TUNER, | 606 | DEVICE_MODE_RAW_TUNER, |
607 | DEVICE_MODE_FM_RADIO, | ||
608 | DEVICE_MODE_FM_RADIO_BDA, | ||
609 | DEVICE_MODE_ATSC, | ||
280 | DEVICE_MODE_MAX, | 610 | DEVICE_MODE_MAX, |
281 | }; | 611 | }; |
282 | 612 | ||
283 | struct SmsMsgHdr_ST { | 613 | struct sms_msg_hdr { |
284 | u16 msgType; | 614 | u16 msg_type; |
285 | u8 msgSrcId; | 615 | u8 msg_src_id; |
286 | u8 msgDstId; | 616 | u8 msg_dst_id; |
287 | u16 msgLength; /* Length of entire message, including header */ | 617 | u16 msg_length; /* length of entire message, including header */ |
288 | u16 msgFlags; | 618 | u16 msg_flags; |
619 | }; | ||
620 | |||
621 | struct sms_msg_data { | ||
622 | struct sms_msg_hdr x_msg_header; | ||
623 | u32 msg_data[1]; | ||
289 | }; | 624 | }; |
290 | 625 | ||
291 | struct SmsMsgData_ST { | 626 | struct sms_msg_data2 { |
292 | struct SmsMsgHdr_ST xMsgHeader; | 627 | struct sms_msg_hdr x_msg_header; |
293 | u32 msgData[1]; | 628 | u32 msg_data[2]; |
294 | }; | 629 | }; |
295 | 630 | ||
296 | struct SmsMsgData_ST2 { | 631 | struct sms_msg_data4 { |
297 | struct SmsMsgHdr_ST xMsgHeader; | 632 | struct sms_msg_hdr x_msg_header; |
298 | u32 msgData[2]; | 633 | u32 msg_data[4]; |
299 | }; | 634 | }; |
300 | 635 | ||
301 | struct SmsDataDownload_ST { | 636 | struct sms_data_download { |
302 | struct SmsMsgHdr_ST xMsgHeader; | 637 | struct sms_msg_hdr x_msg_header; |
303 | u32 MemAddr; | 638 | u32 mem_addr; |
304 | u8 Payload[SMS_MAX_PAYLOAD_SIZE]; | 639 | u8 payload[SMS_MAX_PAYLOAD_SIZE]; |
305 | }; | 640 | }; |
306 | 641 | ||
307 | struct SmsVersionRes_ST { | 642 | struct sms_version_res { |
308 | struct SmsMsgHdr_ST xMsgHeader; | 643 | struct sms_msg_hdr x_msg_header; |
309 | 644 | ||
310 | u16 ChipModel; /* e.g. 0x1102 for SMS-1102 "Nova" */ | 645 | u16 chip_model; /* e.g. 0x1102 for SMS-1102 "Nova" */ |
311 | u8 Step; /* 0 - Step A */ | 646 | u8 step; /* 0 - step A */ |
312 | u8 MetalFix; /* 0 - Metal 0 */ | 647 | u8 metal_fix; /* 0 - Metal 0 */ |
313 | 648 | ||
314 | /* FirmwareId 0xFF if ROM, otherwise the | 649 | /* firmware_id 0xFF if ROM, otherwise the |
315 | * value indicated by SMSHOSTLIB_DEVICE_MODES_E */ | 650 | * value indicated by SMSHOSTLIB_DEVICE_MODES_E */ |
316 | u8 FirmwareId; | 651 | u8 firmware_id; |
317 | /* SupportedProtocols Bitwise OR combination of | 652 | /* supported_protocols Bitwise OR combination of |
318 | * supported protocols */ | 653 | * supported protocols */ |
319 | u8 SupportedProtocols; | 654 | u8 supported_protocols; |
320 | 655 | ||
321 | u8 VersionMajor; | 656 | u8 version_major; |
322 | u8 VersionMinor; | 657 | u8 version_minor; |
323 | u8 VersionPatch; | 658 | u8 version_patch; |
324 | u8 VersionFieldPatch; | 659 | u8 version_field_patch; |
325 | 660 | ||
326 | u8 RomVersionMajor; | 661 | u8 rom_ver_major; |
327 | u8 RomVersionMinor; | 662 | u8 rom_ver_minor; |
328 | u8 RomVersionPatch; | 663 | u8 rom_ver_patch; |
329 | u8 RomVersionFieldPatch; | 664 | u8 rom_ver_field_patch; |
330 | 665 | ||
331 | u8 TextLabel[34]; | 666 | u8 TextLabel[34]; |
332 | }; | 667 | }; |
333 | 668 | ||
334 | struct SmsFirmware_ST { | 669 | struct sms_firmware { |
335 | u32 CheckSum; | 670 | u32 check_sum; |
336 | u32 Length; | 671 | u32 length; |
337 | u32 StartAddress; | 672 | u32 start_address; |
338 | u8 Payload[1]; | 673 | u8 payload[1]; |
339 | }; | 674 | }; |
340 | 675 | ||
341 | /* Statistics information returned as response for | 676 | /* statistics information returned as response for |
342 | * SmsHostApiGetStatistics_Req */ | 677 | * SmsHostApiGetstatistics_Req */ |
343 | struct SMSHOSTLIB_STATISTICS_ST { | 678 | struct sms_stats { |
344 | u32 Reserved; /* Reserved */ | 679 | u32 reserved; /* reserved */ |
345 | 680 | ||
346 | /* Common parameters */ | 681 | /* Common parameters */ |
347 | u32 IsRfLocked; /* 0 - not locked, 1 - locked */ | 682 | u32 is_rf_locked; /* 0 - not locked, 1 - locked */ |
348 | u32 IsDemodLocked; /* 0 - not locked, 1 - locked */ | 683 | u32 is_demod_locked; /* 0 - not locked, 1 - locked */ |
349 | u32 IsExternalLNAOn; /* 0 - external LNA off, 1 - external LNA on */ | 684 | u32 is_external_lna_on; /* 0 - external LNA off, 1 - external LNA on */ |
350 | 685 | ||
351 | /* Reception quality */ | 686 | /* Reception quality */ |
352 | s32 SNR; /* dB */ | 687 | s32 SNR; /* dB */ |
353 | u32 BER; /* Post Viterbi BER [1E-5] */ | 688 | u32 ber; /* Post Viterbi ber [1E-5] */ |
354 | u32 FIB_CRC; /* CRC errors percentage, valid only for DAB */ | 689 | u32 FIB_CRC; /* CRC errors percentage, valid only for DAB */ |
355 | u32 TS_PER; /* Transport stream PER, | 690 | u32 ts_per; /* Transport stream PER, |
356 | 0xFFFFFFFF indicate N/A, valid only for DVB-T/H */ | 691 | 0xFFFFFFFF indicate N/A, valid only for DVB-T/H */ |
357 | u32 MFER; /* DVB-H frame error rate in percentage, | 692 | u32 MFER; /* DVB-H frame error rate in percentage, |
358 | 0xFFFFFFFF indicate N/A, valid only for DVB-H */ | 693 | 0xFFFFFFFF indicate N/A, valid only for DVB-H */ |
359 | s32 RSSI; /* dBm */ | 694 | s32 RSSI; /* dBm */ |
360 | s32 InBandPwr; /* In band power in dBM */ | 695 | s32 in_band_pwr; /* In band power in dBM */ |
361 | s32 CarrierOffset; /* Carrier Offset in bin/1024 */ | 696 | s32 carrier_offset; /* Carrier Offset in bin/1024 */ |
362 | 697 | ||
363 | /* Transmission parameters */ | 698 | /* Transmission parameters */ |
364 | u32 Frequency; /* Frequency in Hz */ | 699 | u32 frequency; /* frequency in Hz */ |
365 | u32 Bandwidth; /* Bandwidth in MHz, valid only for DVB-T/H */ | 700 | u32 bandwidth; /* bandwidth in MHz, valid only for DVB-T/H */ |
366 | u32 TransmissionMode; /* Transmission Mode, for DAB modes 1-4, | 701 | u32 transmission_mode; /* Transmission Mode, for DAB modes 1-4, |
367 | for DVB-T/H FFT mode carriers in Kilos */ | 702 | for DVB-T/H FFT mode carriers in Kilos */ |
368 | u32 ModemState; /* from SMSHOSTLIB_DVB_MODEM_STATE_ET, | 703 | u32 modem_state; /* from SMSHOSTLIB_DVB_MODEM_STATE_ET, |
369 | valid only for DVB-T/H */ | 704 | valid only for DVB-T/H */ |
370 | u32 GuardInterval; /* Guard Interval from | 705 | u32 guard_interval; /* Guard Interval from |
371 | SMSHOSTLIB_GUARD_INTERVALS_ET, valid only for DVB-T/H */ | 706 | SMSHOSTLIB_GUARD_INTERVALS_ET, valid only for DVB-T/H */ |
372 | u32 CodeRate; /* Code Rate from SMSHOSTLIB_CODE_RATE_ET, | 707 | u32 code_rate; /* Code Rate from SMSHOSTLIB_CODE_RATE_ET, |
373 | valid only for DVB-T/H */ | 708 | valid only for DVB-T/H */ |
374 | u32 LPCodeRate; /* Low Priority Code Rate from | 709 | u32 lp_code_rate; /* Low Priority Code Rate from |
375 | SMSHOSTLIB_CODE_RATE_ET, valid only for DVB-T/H */ | 710 | SMSHOSTLIB_CODE_RATE_ET, valid only for DVB-T/H */ |
376 | u32 Hierarchy; /* Hierarchy from SMSHOSTLIB_HIERARCHY_ET, | 711 | u32 hierarchy; /* hierarchy from SMSHOSTLIB_HIERARCHY_ET, |
377 | valid only for DVB-T/H */ | 712 | valid only for DVB-T/H */ |
378 | u32 Constellation; /* Constellation from | 713 | u32 constellation; /* constellation from |
379 | SMSHOSTLIB_CONSTELLATION_ET, valid only for DVB-T/H */ | 714 | SMSHOSTLIB_CONSTELLATION_ET, valid only for DVB-T/H */ |
380 | 715 | ||
381 | /* Burst parameters, valid only for DVB-H */ | 716 | /* Burst parameters, valid only for DVB-H */ |
382 | u32 BurstSize; /* Current burst size in bytes, | 717 | u32 burst_size; /* Current burst size in bytes, |
383 | valid only for DVB-H */ | 718 | valid only for DVB-H */ |
384 | u32 BurstDuration; /* Current burst duration in mSec, | 719 | u32 burst_duration; /* Current burst duration in mSec, |
385 | valid only for DVB-H */ | 720 | valid only for DVB-H */ |
386 | u32 BurstCycleTime; /* Current burst cycle time in mSec, | 721 | u32 burst_cycle_time; /* Current burst cycle time in mSec, |
387 | valid only for DVB-H */ | 722 | valid only for DVB-H */ |
388 | u32 CalculatedBurstCycleTime;/* Current burst cycle time in mSec, | 723 | u32 calc_burst_cycle_time;/* Current burst cycle time in mSec, |
389 | as calculated by demodulator, valid only for DVB-H */ | 724 | as calculated by demodulator, valid only for DVB-H */ |
390 | u32 NumOfRows; /* Number of rows in MPE table, | 725 | u32 num_of_rows; /* Number of rows in MPE table, |
391 | valid only for DVB-H */ | 726 | valid only for DVB-H */ |
392 | u32 NumOfPaddCols; /* Number of padding columns in MPE table, | 727 | u32 num_of_padd_cols; /* Number of padding columns in MPE table, |
393 | valid only for DVB-H */ | 728 | valid only for DVB-H */ |
394 | u32 NumOfPunctCols; /* Number of puncturing columns in MPE table, | 729 | u32 num_of_punct_cols; /* Number of puncturing columns in MPE table, |
395 | valid only for DVB-H */ | 730 | valid only for DVB-H */ |
396 | u32 ErrorTSPackets; /* Number of erroneous | 731 | u32 error_ts_packets; /* Number of erroneous |
397 | transport-stream packets */ | 732 | transport-stream packets */ |
398 | u32 TotalTSPackets; /* Total number of transport-stream packets */ | 733 | u32 total_ts_packets; /* Total number of transport-stream packets */ |
399 | u32 NumOfValidMpeTlbs; /* Number of MPE tables which do not include | 734 | u32 num_of_valid_mpe_tlbs; /* Number of MPE tables which do not include |
400 | errors after MPE RS decoding */ | 735 | errors after MPE RS decoding */ |
401 | u32 NumOfInvalidMpeTlbs;/* Number of MPE tables which include errors | 736 | u32 num_of_invalid_mpe_tlbs;/* Number of MPE tables which include errors |
402 | after MPE RS decoding */ | 737 | after MPE RS decoding */ |
403 | u32 NumOfCorrectedMpeTlbs;/* Number of MPE tables which were | 738 | u32 num_of_corrected_mpe_tlbs;/* Number of MPE tables which were |
404 | corrected by MPE RS decoding */ | 739 | corrected by MPE RS decoding */ |
405 | /* Common params */ | 740 | /* Common params */ |
406 | u32 BERErrorCount; /* Number of errornous SYNC bits. */ | 741 | u32 ber_error_count; /* Number of errornous SYNC bits. */ |
407 | u32 BERBitCount; /* Total number of SYNC bits. */ | 742 | u32 ber_bit_count; /* Total number of SYNC bits. */ |
408 | 743 | ||
409 | /* Interface information */ | 744 | /* Interface information */ |
410 | u32 SmsToHostTxErrors; /* Total number of transmission errors. */ | 745 | u32 sms_to_host_tx_errors; /* Total number of transmission errors. */ |
411 | 746 | ||
412 | /* DAB/T-DMB */ | 747 | /* DAB/T-DMB */ |
413 | u32 PreBER; /* DAB/T-DMB only: Pre Viterbi BER [1E-5] */ | 748 | u32 pre_ber; /* DAB/T-DMB only: Pre Viterbi ber [1E-5] */ |
414 | 749 | ||
415 | /* DVB-H TPS parameters */ | 750 | /* DVB-H TPS parameters */ |
416 | u32 CellId; /* TPS Cell ID in bits 15..0, bits 31..16 zero; | 751 | u32 cell_id; /* TPS Cell ID in bits 15..0, bits 31..16 zero; |
417 | if set to 0xFFFFFFFF cell_id not yet recovered */ | 752 | if set to 0xFFFFFFFF cell_id not yet recovered */ |
418 | u32 DvbhSrvIndHP; /* DVB-H service indication info, bit 1 - | 753 | u32 dvbh_srv_ind_hp; /* DVB-H service indication info, bit 1 - |
419 | Time Slicing indicator, bit 0 - MPE-FEC indicator */ | 754 | Time Slicing indicator, bit 0 - MPE-FEC indicator */ |
420 | u32 DvbhSrvIndLP; /* DVB-H service indication info, bit 1 - | 755 | u32 dvbh_srv_ind_lp; /* DVB-H service indication info, bit 1 - |
421 | Time Slicing indicator, bit 0 - MPE-FEC indicator */ | 756 | Time Slicing indicator, bit 0 - MPE-FEC indicator */ |
422 | 757 | ||
423 | u32 NumMPEReceived; /* DVB-H, Num MPE section received */ | 758 | u32 num_mpe_received; /* DVB-H, Num MPE section received */ |
424 | 759 | ||
425 | u32 ReservedFields[10]; /* Reserved */ | 760 | u32 reservedFields[10]; /* reserved */ |
426 | }; | 761 | }; |
427 | 762 | ||
428 | struct SmsMsgStatisticsInfo_ST { | 763 | struct sms_msg_statistics_info { |
429 | u32 RequestResult; | 764 | u32 request_result; |
430 | 765 | ||
431 | struct SMSHOSTLIB_STATISTICS_ST Stat; | 766 | struct sms_stats stat; |
432 | 767 | ||
433 | /* Split the calc of the SNR in DAB */ | 768 | /* Split the calc of the SNR in DAB */ |
434 | u32 Signal; /* dB */ | 769 | u32 signal; /* dB */ |
435 | u32 Noise; /* dB */ | 770 | u32 noise; /* dB */ |
436 | 771 | ||
437 | }; | 772 | }; |
438 | 773 | ||
439 | struct SMSHOSTLIB_ISDBT_LAYER_STAT_ST { | 774 | struct sms_isdbt_layer_stats { |
440 | /* Per-layer information */ | 775 | /* Per-layer information */ |
441 | u32 CodeRate; /* Code Rate from SMSHOSTLIB_CODE_RATE_ET, | 776 | u32 code_rate; /* Code Rate from SMSHOSTLIB_CODE_RATE_ET, |
442 | * 255 means layer does not exist */ | 777 | * 255 means layer does not exist */ |
443 | u32 Constellation; /* Constellation from SMSHOSTLIB_CONSTELLATION_ET, | 778 | u32 constellation; /* constellation from SMSHOSTLIB_CONSTELLATION_ET, |
444 | * 255 means layer does not exist */ | 779 | * 255 means layer does not exist */ |
445 | u32 BER; /* Post Viterbi BER [1E-5], 0xFFFFFFFF indicate N/A */ | 780 | u32 ber; /* Post Viterbi ber [1E-5], 0xFFFFFFFF indicate N/A */ |
446 | u32 BERErrorCount; /* Post Viterbi Error Bits Count */ | 781 | u32 ber_error_count; /* Post Viterbi Error Bits Count */ |
447 | u32 BERBitCount; /* Post Viterbi Total Bits Count */ | 782 | u32 ber_bit_count; /* Post Viterbi Total Bits Count */ |
448 | u32 PreBER; /* Pre Viterbi BER [1E-5], 0xFFFFFFFF indicate N/A */ | 783 | u32 pre_ber; /* Pre Viterbi ber [1E-5], 0xFFFFFFFF indicate N/A */ |
449 | u32 TS_PER; /* Transport stream PER [%], 0xFFFFFFFF indicate N/A */ | 784 | u32 ts_per; /* Transport stream PER [%], 0xFFFFFFFF indicate N/A */ |
450 | u32 ErrorTSPackets; /* Number of erroneous transport-stream packets */ | 785 | u32 error_ts_packets; /* Number of erroneous transport-stream packets */ |
451 | u32 TotalTSPackets; /* Total number of transport-stream packets */ | 786 | u32 total_ts_packets; /* Total number of transport-stream packets */ |
452 | u32 TILdepthI; /* Time interleaver depth I parameter, | 787 | u32 ti_ldepth_i; /* Time interleaver depth I parameter, |
453 | * 255 means layer does not exist */ | 788 | * 255 means layer does not exist */ |
454 | u32 NumberOfSegments; /* Number of segments in layer A, | 789 | u32 number_of_segments; /* Number of segments in layer A, |
455 | * 255 means layer does not exist */ | 790 | * 255 means layer does not exist */ |
456 | u32 TMCCErrors; /* TMCC errors */ | 791 | u32 tmcc_errors; /* TMCC errors */ |
457 | }; | 792 | }; |
458 | 793 | ||
459 | struct SMSHOSTLIB_STATISTICS_ISDBT_ST { | 794 | struct sms_isdbt_stats { |
460 | u32 StatisticsType; /* Enumerator identifying the type of the | 795 | u32 statistics_type; /* Enumerator identifying the type of the |
461 | * structure. Values are the same as | 796 | * structure. Values are the same as |
462 | * SMSHOSTLIB_DEVICE_MODES_E | 797 | * SMSHOSTLIB_DEVICE_MODES_E |
463 | * | 798 | * |
464 | * This field MUST always be first in any | 799 | * This field MUST always be first in any |
465 | * statistics structure */ | 800 | * statistics structure */ |
466 | 801 | ||
467 | u32 FullSize; /* Total size of the structure returned by the modem. | 802 | u32 full_size; /* Total size of the structure returned by the modem. |
468 | * If the size requested by the host is smaller than | 803 | * If the size requested by the host is smaller than |
469 | * FullSize, the struct will be truncated */ | 804 | * full_size, the struct will be truncated */ |
470 | 805 | ||
471 | /* Common parameters */ | 806 | /* Common parameters */ |
472 | u32 IsRfLocked; /* 0 - not locked, 1 - locked */ | 807 | u32 is_rf_locked; /* 0 - not locked, 1 - locked */ |
473 | u32 IsDemodLocked; /* 0 - not locked, 1 - locked */ | 808 | u32 is_demod_locked; /* 0 - not locked, 1 - locked */ |
474 | u32 IsExternalLNAOn; /* 0 - external LNA off, 1 - external LNA on */ | 809 | u32 is_external_lna_on; /* 0 - external LNA off, 1 - external LNA on */ |
475 | 810 | ||
476 | /* Reception quality */ | 811 | /* Reception quality */ |
477 | s32 SNR; /* dB */ | 812 | s32 SNR; /* dB */ |
478 | s32 RSSI; /* dBm */ | 813 | s32 RSSI; /* dBm */ |
479 | s32 InBandPwr; /* In band power in dBM */ | 814 | s32 in_band_pwr; /* In band power in dBM */ |
480 | s32 CarrierOffset; /* Carrier Offset in Hz */ | 815 | s32 carrier_offset; /* Carrier Offset in Hz */ |
481 | 816 | ||
482 | /* Transmission parameters */ | 817 | /* Transmission parameters */ |
483 | u32 Frequency; /* Frequency in Hz */ | 818 | u32 frequency; /* frequency in Hz */ |
484 | u32 Bandwidth; /* Bandwidth in MHz */ | 819 | u32 bandwidth; /* bandwidth in MHz */ |
485 | u32 TransmissionMode; /* ISDB-T transmission mode */ | 820 | u32 transmission_mode; /* ISDB-T transmission mode */ |
486 | u32 ModemState; /* 0 - Acquisition, 1 - Locked */ | 821 | u32 modem_state; /* 0 - Acquisition, 1 - Locked */ |
487 | u32 GuardInterval; /* Guard Interval, 1 divided by value */ | 822 | u32 guard_interval; /* Guard Interval, 1 divided by value */ |
488 | u32 SystemType; /* ISDB-T system type (ISDB-T / ISDB-Tsb) */ | 823 | u32 system_type; /* ISDB-T system type (ISDB-T / ISDB-Tsb) */ |
489 | u32 PartialReception; /* TRUE - partial reception, FALSE otherwise */ | 824 | u32 partial_reception; /* TRUE - partial reception, FALSE otherwise */ |
490 | u32 NumOfLayers; /* Number of ISDB-T layers in the network */ | 825 | u32 num_of_layers; /* Number of ISDB-T layers in the network */ |
491 | 826 | ||
492 | /* Per-layer information */ | 827 | /* Per-layer information */ |
493 | /* Layers A, B and C */ | 828 | /* Layers A, B and C */ |
494 | struct SMSHOSTLIB_ISDBT_LAYER_STAT_ST LayerInfo[3]; | 829 | struct sms_isdbt_layer_stats layer_info[3]; |
495 | /* Per-layer statistics, see SMSHOSTLIB_ISDBT_LAYER_STAT_ST */ | 830 | /* Per-layer statistics, see sms_isdbt_layer_stats */ |
496 | 831 | ||
497 | /* Interface information */ | 832 | /* Interface information */ |
498 | u32 SmsToHostTxErrors; /* Total number of transmission errors. */ | 833 | u32 sms_to_host_tx_errors; /* Total number of transmission errors. */ |
499 | }; | 834 | }; |
500 | 835 | ||
501 | struct PID_STATISTICS_DATA_S { | 836 | struct sms_isdbt_stats_ex { |
837 | u32 statistics_type; /* Enumerator identifying the type of the | ||
838 | * structure. Values are the same as | ||
839 | * SMSHOSTLIB_DEVICE_MODES_E | ||
840 | * | ||
841 | * This field MUST always be first in any | ||
842 | * statistics structure */ | ||
843 | |||
844 | u32 full_size; /* Total size of the structure returned by the modem. | ||
845 | * If the size requested by the host is smaller than | ||
846 | * full_size, the struct will be truncated */ | ||
847 | |||
848 | /* Common parameters */ | ||
849 | u32 is_rf_locked; /* 0 - not locked, 1 - locked */ | ||
850 | u32 is_demod_locked; /* 0 - not locked, 1 - locked */ | ||
851 | u32 is_external_lna_on; /* 0 - external LNA off, 1 - external LNA on */ | ||
852 | |||
853 | /* Reception quality */ | ||
854 | s32 SNR; /* dB */ | ||
855 | s32 RSSI; /* dBm */ | ||
856 | s32 in_band_pwr; /* In band power in dBM */ | ||
857 | s32 carrier_offset; /* Carrier Offset in Hz */ | ||
858 | |||
859 | /* Transmission parameters */ | ||
860 | u32 frequency; /* frequency in Hz */ | ||
861 | u32 bandwidth; /* bandwidth in MHz */ | ||
862 | u32 transmission_mode; /* ISDB-T transmission mode */ | ||
863 | u32 modem_state; /* 0 - Acquisition, 1 - Locked */ | ||
864 | u32 guard_interval; /* Guard Interval, 1 divided by value */ | ||
865 | u32 system_type; /* ISDB-T system type (ISDB-T / ISDB-Tsb) */ | ||
866 | u32 partial_reception; /* TRUE - partial reception, FALSE otherwise */ | ||
867 | u32 num_of_layers; /* Number of ISDB-T layers in the network */ | ||
868 | |||
869 | u32 segment_number; /* Segment number for ISDB-Tsb */ | ||
870 | u32 tune_bw; /* Tuned bandwidth - BW_ISDBT_1SEG / BW_ISDBT_3SEG */ | ||
871 | |||
872 | /* Per-layer information */ | ||
873 | /* Layers A, B and C */ | ||
874 | struct sms_isdbt_layer_stats layer_info[3]; | ||
875 | /* Per-layer statistics, see sms_isdbt_layer_stats */ | ||
876 | |||
877 | /* Interface information */ | ||
878 | u32 reserved1; /* Was sms_to_host_tx_errors - obsolete . */ | ||
879 | /* Proprietary information */ | ||
880 | u32 ext_antenna; /* Obsolete field. */ | ||
881 | u32 reception_quality; | ||
882 | u32 ews_alert_active; /* signals if EWS alert is currently on */ | ||
883 | u32 lna_on_off; /* Internal LNA state: 0: OFF, 1: ON */ | ||
884 | |||
885 | u32 rf_agc_level; /* RF AGC Level [linear units], full gain = 65535 (20dB) */ | ||
886 | u32 bb_agc_level; /* Baseband AGC level [linear units], full gain = 65535 (71.5dB) */ | ||
887 | u32 fw_errors_counter; /* Application errors - should be always zero */ | ||
888 | u8 FwErrorsHistoryArr[8]; /* Last FW errors IDs - first is most recent, last is oldest */ | ||
889 | |||
890 | s32 MRC_SNR; /* dB */ | ||
891 | u32 snr_full_res; /* dB x 65536 */ | ||
892 | u32 reserved4[4]; | ||
893 | }; | ||
894 | |||
895 | |||
896 | struct sms_pid_stats_data { | ||
502 | struct PID_BURST_S { | 897 | struct PID_BURST_S { |
503 | u32 size; | 898 | u32 size; |
504 | u32 padding_cols; | 899 | u32 padding_cols; |
@@ -513,112 +908,155 @@ struct PID_STATISTICS_DATA_S { | |||
513 | u32 tot_cor_tbl; | 908 | u32 tot_cor_tbl; |
514 | }; | 909 | }; |
515 | 910 | ||
516 | struct PID_DATA_S { | 911 | struct sms_pid_data { |
517 | u32 pid; | 912 | u32 pid; |
518 | u32 num_rows; | 913 | u32 num_rows; |
519 | struct PID_STATISTICS_DATA_S pid_statistics; | 914 | struct sms_pid_stats_data pid_statistics; |
520 | }; | 915 | }; |
521 | 916 | ||
522 | #define CORRECT_STAT_RSSI(_stat) ((_stat).RSSI *= -1) | 917 | #define CORRECT_STAT_RSSI(_stat) ((_stat).RSSI *= -1) |
523 | #define CORRECT_STAT_BANDWIDTH(_stat) (_stat.Bandwidth = 8 - _stat.Bandwidth) | 918 | #define CORRECT_STAT_BANDWIDTH(_stat) (_stat.bandwidth = 8 - _stat.bandwidth) |
524 | #define CORRECT_STAT_TRANSMISSON_MODE(_stat) \ | 919 | #define CORRECT_STAT_TRANSMISSON_MODE(_stat) \ |
525 | if (_stat.TransmissionMode == 0) \ | 920 | if (_stat.transmission_mode == 0) \ |
526 | _stat.TransmissionMode = 2; \ | 921 | _stat.transmission_mode = 2; \ |
527 | else if (_stat.TransmissionMode == 1) \ | 922 | else if (_stat.transmission_mode == 1) \ |
528 | _stat.TransmissionMode = 8; \ | 923 | _stat.transmission_mode = 8; \ |
529 | else \ | 924 | else \ |
530 | _stat.TransmissionMode = 4; | 925 | _stat.transmission_mode = 4; |
531 | 926 | ||
532 | struct TRANSMISSION_STATISTICS_S { | 927 | struct sms_tx_stats { |
533 | u32 Frequency; /* Frequency in Hz */ | 928 | u32 frequency; /* frequency in Hz */ |
534 | u32 Bandwidth; /* Bandwidth in MHz */ | 929 | u32 bandwidth; /* bandwidth in MHz */ |
535 | u32 TransmissionMode; /* FFT mode carriers in Kilos */ | 930 | u32 transmission_mode; /* FFT mode carriers in Kilos */ |
536 | u32 GuardInterval; /* Guard Interval from | 931 | u32 guard_interval; /* Guard Interval from |
537 | SMSHOSTLIB_GUARD_INTERVALS_ET */ | 932 | SMSHOSTLIB_GUARD_INTERVALS_ET */ |
538 | u32 CodeRate; /* Code Rate from SMSHOSTLIB_CODE_RATE_ET */ | 933 | u32 code_rate; /* Code Rate from SMSHOSTLIB_CODE_RATE_ET */ |
539 | u32 LPCodeRate; /* Low Priority Code Rate from | 934 | u32 lp_code_rate; /* Low Priority Code Rate from |
540 | SMSHOSTLIB_CODE_RATE_ET */ | 935 | SMSHOSTLIB_CODE_RATE_ET */ |
541 | u32 Hierarchy; /* Hierarchy from SMSHOSTLIB_HIERARCHY_ET */ | 936 | u32 hierarchy; /* hierarchy from SMSHOSTLIB_HIERARCHY_ET */ |
542 | u32 Constellation; /* Constellation from | 937 | u32 constellation; /* constellation from |
543 | SMSHOSTLIB_CONSTELLATION_ET */ | 938 | SMSHOSTLIB_CONSTELLATION_ET */ |
544 | 939 | ||
545 | /* DVB-H TPS parameters */ | 940 | /* DVB-H TPS parameters */ |
546 | u32 CellId; /* TPS Cell ID in bits 15..0, bits 31..16 zero; | 941 | u32 cell_id; /* TPS Cell ID in bits 15..0, bits 31..16 zero; |
547 | if set to 0xFFFFFFFF cell_id not yet recovered */ | 942 | if set to 0xFFFFFFFF cell_id not yet recovered */ |
548 | u32 DvbhSrvIndHP; /* DVB-H service indication info, bit 1 - | 943 | u32 dvbh_srv_ind_hp; /* DVB-H service indication info, bit 1 - |
549 | Time Slicing indicator, bit 0 - MPE-FEC indicator */ | 944 | Time Slicing indicator, bit 0 - MPE-FEC indicator */ |
550 | u32 DvbhSrvIndLP; /* DVB-H service indication info, bit 1 - | 945 | u32 dvbh_srv_ind_lp; /* DVB-H service indication info, bit 1 - |
551 | Time Slicing indicator, bit 0 - MPE-FEC indicator */ | 946 | Time Slicing indicator, bit 0 - MPE-FEC indicator */ |
552 | u32 IsDemodLocked; /* 0 - not locked, 1 - locked */ | 947 | u32 is_demod_locked; /* 0 - not locked, 1 - locked */ |
948 | }; | ||
949 | |||
950 | struct sms_rx_stats { | ||
951 | u32 is_rf_locked; /* 0 - not locked, 1 - locked */ | ||
952 | u32 is_demod_locked; /* 0 - not locked, 1 - locked */ | ||
953 | u32 is_external_lna_on; /* 0 - external LNA off, 1 - external LNA on */ | ||
954 | |||
955 | u32 modem_state; /* from SMSHOSTLIB_DVB_MODEM_STATE_ET */ | ||
956 | s32 SNR; /* dB */ | ||
957 | u32 ber; /* Post Viterbi ber [1E-5] */ | ||
958 | u32 ber_error_count; /* Number of erronous SYNC bits. */ | ||
959 | u32 ber_bit_count; /* Total number of SYNC bits. */ | ||
960 | u32 ts_per; /* Transport stream PER, | ||
961 | 0xFFFFFFFF indicate N/A */ | ||
962 | u32 MFER; /* DVB-H frame error rate in percentage, | ||
963 | 0xFFFFFFFF indicate N/A, valid only for DVB-H */ | ||
964 | s32 RSSI; /* dBm */ | ||
965 | s32 in_band_pwr; /* In band power in dBM */ | ||
966 | s32 carrier_offset; /* Carrier Offset in bin/1024 */ | ||
967 | u32 error_ts_packets; /* Number of erroneous | ||
968 | transport-stream packets */ | ||
969 | u32 total_ts_packets; /* Total number of transport-stream packets */ | ||
970 | |||
971 | s32 MRC_SNR; /* dB */ | ||
972 | s32 MRC_RSSI; /* dBm */ | ||
973 | s32 mrc_in_band_pwr; /* In band power in dBM */ | ||
553 | }; | 974 | }; |
554 | 975 | ||
555 | struct RECEPTION_STATISTICS_S { | 976 | struct sms_rx_stats_ex { |
556 | u32 IsRfLocked; /* 0 - not locked, 1 - locked */ | 977 | u32 is_rf_locked; /* 0 - not locked, 1 - locked */ |
557 | u32 IsDemodLocked; /* 0 - not locked, 1 - locked */ | 978 | u32 is_demod_locked; /* 0 - not locked, 1 - locked */ |
558 | u32 IsExternalLNAOn; /* 0 - external LNA off, 1 - external LNA on */ | 979 | u32 is_external_lna_on; /* 0 - external LNA off, 1 - external LNA on */ |
559 | 980 | ||
560 | u32 ModemState; /* from SMSHOSTLIB_DVB_MODEM_STATE_ET */ | 981 | u32 modem_state; /* from SMSHOSTLIB_DVB_MODEM_STATE_ET */ |
561 | s32 SNR; /* dB */ | 982 | s32 SNR; /* dB */ |
562 | u32 BER; /* Post Viterbi BER [1E-5] */ | 983 | u32 ber; /* Post Viterbi ber [1E-5] */ |
563 | u32 BERErrorCount; /* Number of erronous SYNC bits. */ | 984 | u32 ber_error_count; /* Number of erronous SYNC bits. */ |
564 | u32 BERBitCount; /* Total number of SYNC bits. */ | 985 | u32 ber_bit_count; /* Total number of SYNC bits. */ |
565 | u32 TS_PER; /* Transport stream PER, | 986 | u32 ts_per; /* Transport stream PER, |
566 | 0xFFFFFFFF indicate N/A */ | 987 | 0xFFFFFFFF indicate N/A */ |
567 | u32 MFER; /* DVB-H frame error rate in percentage, | 988 | u32 MFER; /* DVB-H frame error rate in percentage, |
568 | 0xFFFFFFFF indicate N/A, valid only for DVB-H */ | 989 | 0xFFFFFFFF indicate N/A, valid only for DVB-H */ |
569 | s32 RSSI; /* dBm */ | 990 | s32 RSSI; /* dBm */ |
570 | s32 InBandPwr; /* In band power in dBM */ | 991 | s32 in_band_pwr; /* In band power in dBM */ |
571 | s32 CarrierOffset; /* Carrier Offset in bin/1024 */ | 992 | s32 carrier_offset; /* Carrier Offset in bin/1024 */ |
572 | u32 ErrorTSPackets; /* Number of erroneous | 993 | u32 error_ts_packets; /* Number of erroneous |
573 | transport-stream packets */ | 994 | transport-stream packets */ |
574 | u32 TotalTSPackets; /* Total number of transport-stream packets */ | 995 | u32 total_ts_packets; /* Total number of transport-stream packets */ |
996 | |||
997 | s32 ref_dev_ppm; | ||
998 | s32 freq_dev_hz; | ||
575 | 999 | ||
576 | s32 MRC_SNR; /* dB */ | 1000 | s32 MRC_SNR; /* dB */ |
577 | s32 MRC_RSSI; /* dBm */ | 1001 | s32 MRC_RSSI; /* dBm */ |
578 | s32 MRC_InBandPwr; /* In band power in dBM */ | 1002 | s32 mrc_in_band_pwr; /* In band power in dBM */ |
579 | }; | 1003 | }; |
580 | 1004 | ||
581 | 1005 | ||
582 | /* Statistics information returned as response for | 1006 | /* statistics information returned as response for |
583 | * SmsHostApiGetStatisticsEx_Req for DVB applications, SMS1100 and up */ | 1007 | * SmsHostApiGetstatisticsEx_Req for DVB applications, SMS1100 and up */ |
584 | struct SMSHOSTLIB_STATISTICS_DVB_S { | 1008 | struct sms_stats_dvb { |
585 | /* Reception */ | 1009 | /* Reception */ |
586 | struct RECEPTION_STATISTICS_S ReceptionData; | 1010 | struct sms_rx_stats reception_data; |
587 | 1011 | ||
588 | /* Transmission parameters */ | 1012 | /* Transmission parameters */ |
589 | struct TRANSMISSION_STATISTICS_S TransmissionData; | 1013 | struct sms_tx_stats transmission_data; |
590 | 1014 | ||
591 | /* Burst parameters, valid only for DVB-H */ | 1015 | /* Burst parameters, valid only for DVB-H */ |
592 | #define SRVM_MAX_PID_FILTERS 8 | 1016 | #define SRVM_MAX_PID_FILTERS 8 |
593 | struct PID_DATA_S PidData[SRVM_MAX_PID_FILTERS]; | 1017 | struct sms_pid_data pid_data[SRVM_MAX_PID_FILTERS]; |
594 | }; | 1018 | }; |
595 | 1019 | ||
596 | struct SRVM_SIGNAL_STATUS_S { | 1020 | /* statistics information returned as response for |
1021 | * SmsHostApiGetstatisticsEx_Req for DVB applications, SMS1100 and up */ | ||
1022 | struct sms_stats_dvb_ex { | ||
1023 | /* Reception */ | ||
1024 | struct sms_rx_stats_ex reception_data; | ||
1025 | |||
1026 | /* Transmission parameters */ | ||
1027 | struct sms_tx_stats transmission_data; | ||
1028 | |||
1029 | /* Burst parameters, valid only for DVB-H */ | ||
1030 | #define SRVM_MAX_PID_FILTERS 8 | ||
1031 | struct sms_pid_data pid_data[SRVM_MAX_PID_FILTERS]; | ||
1032 | }; | ||
1033 | |||
1034 | struct sms_srvm_signal_status { | ||
597 | u32 result; | 1035 | u32 result; |
598 | u32 snr; | 1036 | u32 snr; |
599 | u32 tsPackets; | 1037 | u32 ts_packets; |
600 | u32 etsPackets; | 1038 | u32 ets_packets; |
601 | u32 constellation; | 1039 | u32 constellation; |
602 | u32 hpCode; | 1040 | u32 hp_code; |
603 | u32 tpsSrvIndLP; | 1041 | u32 tps_srv_ind_lp; |
604 | u32 tpsSrvIndHP; | 1042 | u32 tps_srv_ind_hp; |
605 | u32 cellId; | 1043 | u32 cell_id; |
606 | u32 reason; | 1044 | u32 reason; |
607 | 1045 | ||
608 | s32 inBandPower; | 1046 | s32 in_band_power; |
609 | u32 requestId; | 1047 | u32 request_id; |
610 | }; | 1048 | }; |
611 | 1049 | ||
612 | struct SMSHOSTLIB_I2C_REQ_ST { | 1050 | struct sms_i2c_req { |
613 | u32 DeviceAddress; /* I2c device address */ | 1051 | u32 device_address; /* I2c device address */ |
614 | u32 WriteCount; /* number of bytes to write */ | 1052 | u32 write_count; /* number of bytes to write */ |
615 | u32 ReadCount; /* number of bytes to read */ | 1053 | u32 read_count; /* number of bytes to read */ |
616 | u8 Data[1]; | 1054 | u8 Data[1]; |
617 | }; | 1055 | }; |
618 | 1056 | ||
619 | struct SMSHOSTLIB_I2C_RES_ST { | 1057 | struct sms_i2c_res { |
620 | u32 Status; /* non-zero value in case of failure */ | 1058 | u32 status; /* non-zero value in case of failure */ |
621 | u32 ReadCount; /* number of bytes read */ | 1059 | u32 read_count; /* number of bytes read */ |
622 | u8 Data[1]; | 1060 | u8 Data[1]; |
623 | }; | 1061 | }; |
624 | 1062 | ||
@@ -638,59 +1076,39 @@ struct smscore_config_gpio { | |||
638 | #define SMS_GPIO_INPUTCHARACTERISTICS_SCHMITT 1 | 1076 | #define SMS_GPIO_INPUTCHARACTERISTICS_SCHMITT 1 |
639 | u8 inputcharacteristics; | 1077 | u8 inputcharacteristics; |
640 | 1078 | ||
641 | #define SMS_GPIO_OUTPUTSLEWRATE_FAST 0 | 1079 | /* 10xx */ |
642 | #define SMS_GPIO_OUTPUTSLEWRATE_SLOW 1 | 1080 | #define SMS_GPIO_OUTPUT_SLEW_RATE_FAST 0 |
643 | u8 outputslewrate; | 1081 | #define SMS_GPIO_OUTPUT_SLEW_WRATE_SLOW 1 |
644 | |||
645 | #define SMS_GPIO_OUTPUTDRIVING_4mA 0 | ||
646 | #define SMS_GPIO_OUTPUTDRIVING_8mA 1 | ||
647 | #define SMS_GPIO_OUTPUTDRIVING_12mA 2 | ||
648 | #define SMS_GPIO_OUTPUTDRIVING_16mA 3 | ||
649 | u8 outputdriving; | ||
650 | }; | ||
651 | |||
652 | struct smscore_gpio_config { | ||
653 | #define SMS_GPIO_DIRECTION_INPUT 0 | ||
654 | #define SMS_GPIO_DIRECTION_OUTPUT 1 | ||
655 | u8 Direction; | ||
656 | |||
657 | #define SMS_GPIO_PULL_UP_DOWN_NONE 0 | ||
658 | #define SMS_GPIO_PULL_UP_DOWN_PULLDOWN 1 | ||
659 | #define SMS_GPIO_PULL_UP_DOWN_PULLUP 2 | ||
660 | #define SMS_GPIO_PULL_UP_DOWN_KEEPER 3 | ||
661 | u8 PullUpDown; | ||
662 | |||
663 | #define SMS_GPIO_INPUT_CHARACTERISTICS_NORMAL 0 | ||
664 | #define SMS_GPIO_INPUT_CHARACTERISTICS_SCHMITT 1 | ||
665 | u8 InputCharacteristics; | ||
666 | |||
667 | #define SMS_GPIO_OUTPUT_SLEW_RATE_SLOW 1 /* 10xx */ | ||
668 | #define SMS_GPIO_OUTPUT_SLEW_RATE_FAST 0 /* 10xx */ | ||
669 | 1082 | ||
1083 | /* 11xx */ | ||
1084 | #define SMS_GPIO_OUTPUT_SLEW_RATE_0_45_V_NS 0 | ||
1085 | #define SMS_GPIO_OUTPUT_SLEW_RATE_0_9_V_NS 1 | ||
1086 | #define SMS_GPIO_OUTPUT_SLEW_RATE_1_7_V_NS 2 | ||
1087 | #define SMS_GPIO_OUTPUT_SLEW_RATE_3_3_V_NS 3 | ||
670 | 1088 | ||
671 | #define SMS_GPIO_OUTPUT_SLEW_RATE_0_45_V_NS 0 /* 11xx */ | 1089 | u8 outputslewrate; |
672 | #define SMS_GPIO_OUTPUT_SLEW_RATE_0_9_V_NS 1 /* 11xx */ | ||
673 | #define SMS_GPIO_OUTPUT_SLEW_RATE_1_7_V_NS 2 /* 11xx */ | ||
674 | #define SMS_GPIO_OUTPUT_SLEW_RATE_3_3_V_NS 3 /* 11xx */ | ||
675 | u8 OutputSlewRate; | ||
676 | 1090 | ||
677 | #define SMS_GPIO_OUTPUT_DRIVING_S_4mA 0 /* 10xx */ | 1091 | /* 10xx */ |
678 | #define SMS_GPIO_OUTPUT_DRIVING_S_8mA 1 /* 10xx */ | 1092 | #define SMS_GPIO_OUTPUTDRIVING_S_4mA 0 |
679 | #define SMS_GPIO_OUTPUT_DRIVING_S_12mA 2 /* 10xx */ | 1093 | #define SMS_GPIO_OUTPUTDRIVING_S_8mA 1 |
680 | #define SMS_GPIO_OUTPUT_DRIVING_S_16mA 3 /* 10xx */ | 1094 | #define SMS_GPIO_OUTPUTDRIVING_S_12mA 2 |
1095 | #define SMS_GPIO_OUTPUTDRIVING_S_16mA 3 | ||
1096 | |||
1097 | /* 11xx*/ | ||
1098 | #define SMS_GPIO_OUTPUTDRIVING_1_5mA 0 | ||
1099 | #define SMS_GPIO_OUTPUTDRIVING_2_8mA 1 | ||
1100 | #define SMS_GPIO_OUTPUTDRIVING_4mA 2 | ||
1101 | #define SMS_GPIO_OUTPUTDRIVING_7mA 3 | ||
1102 | #define SMS_GPIO_OUTPUTDRIVING_10mA 4 | ||
1103 | #define SMS_GPIO_OUTPUTDRIVING_11mA 5 | ||
1104 | #define SMS_GPIO_OUTPUTDRIVING_14mA 6 | ||
1105 | #define SMS_GPIO_OUTPUTDRIVING_16mA 7 | ||
681 | 1106 | ||
682 | #define SMS_GPIO_OUTPUT_DRIVING_1_5mA 0 /* 11xx */ | 1107 | u8 outputdriving; |
683 | #define SMS_GPIO_OUTPUT_DRIVING_2_8mA 1 /* 11xx */ | ||
684 | #define SMS_GPIO_OUTPUT_DRIVING_4mA 2 /* 11xx */ | ||
685 | #define SMS_GPIO_OUTPUT_DRIVING_7mA 3 /* 11xx */ | ||
686 | #define SMS_GPIO_OUTPUT_DRIVING_10mA 4 /* 11xx */ | ||
687 | #define SMS_GPIO_OUTPUT_DRIVING_11mA 5 /* 11xx */ | ||
688 | #define SMS_GPIO_OUTPUT_DRIVING_14mA 6 /* 11xx */ | ||
689 | #define SMS_GPIO_OUTPUT_DRIVING_16mA 7 /* 11xx */ | ||
690 | u8 OutputDriving; | ||
691 | }; | 1108 | }; |
692 | 1109 | ||
693 | extern void smscore_registry_setmode(char *devpath, int mode); | 1110 | char *smscore_translate_msg(enum msg_types msgtype); |
1111 | |||
694 | extern int smscore_registry_getmode(char *devpath); | 1112 | extern int smscore_registry_getmode(char *devpath); |
695 | 1113 | ||
696 | extern int smscore_register_hotplug(hotplug_t hotplug); | 1114 | extern int smscore_register_hotplug(hotplug_t hotplug); |
@@ -721,8 +1139,6 @@ extern void smscore_onresponse(struct smscore_device_t *coredev, | |||
721 | extern int smscore_get_common_buffer_size(struct smscore_device_t *coredev); | 1139 | extern int smscore_get_common_buffer_size(struct smscore_device_t *coredev); |
722 | extern int smscore_map_common_buffer(struct smscore_device_t *coredev, | 1140 | extern int smscore_map_common_buffer(struct smscore_device_t *coredev, |
723 | struct vm_area_struct *vma); | 1141 | struct vm_area_struct *vma); |
724 | extern int smscore_get_fw_filename(struct smscore_device_t *coredev, | ||
725 | int mode, char *filename); | ||
726 | extern int smscore_send_fw_file(struct smscore_device_t *coredev, | 1142 | extern int smscore_send_fw_file(struct smscore_device_t *coredev, |
727 | u8 *ufwbuf, int size); | 1143 | u8 *ufwbuf, int size); |
728 | 1144 | ||
@@ -737,11 +1153,11 @@ int smscore_configure_gpio(struct smscore_device_t *coredev, u32 pin, | |||
737 | int smscore_set_gpio(struct smscore_device_t *coredev, u32 pin, int level); | 1153 | int smscore_set_gpio(struct smscore_device_t *coredev, u32 pin, int level); |
738 | 1154 | ||
739 | /* new GPIO management */ | 1155 | /* new GPIO management */ |
740 | extern int smscore_gpio_configure(struct smscore_device_t *coredev, u8 PinNum, | 1156 | extern int smscore_gpio_configure(struct smscore_device_t *coredev, u8 pin_num, |
741 | struct smscore_gpio_config *pGpioConfig); | 1157 | struct smscore_config_gpio *p_gpio_config); |
742 | extern int smscore_gpio_set_level(struct smscore_device_t *coredev, u8 PinNum, | 1158 | extern int smscore_gpio_set_level(struct smscore_device_t *coredev, u8 pin_num, |
743 | u8 NewLevel); | 1159 | u8 new_level); |
744 | extern int smscore_gpio_get_level(struct smscore_device_t *coredev, u8 PinNum, | 1160 | extern int smscore_gpio_get_level(struct smscore_device_t *coredev, u8 pin_num, |
745 | u8 *level); | 1161 | u8 *level); |
746 | 1162 | ||
747 | void smscore_set_board_id(struct smscore_device_t *core, int id); | 1163 | void smscore_set_board_id(struct smscore_device_t *core, int id); |
@@ -760,7 +1176,8 @@ int smscore_led_state(struct smscore_device_t *core, int led); | |||
760 | 1176 | ||
761 | #define dprintk(kern, lvl, fmt, arg...) do {\ | 1177 | #define dprintk(kern, lvl, fmt, arg...) do {\ |
762 | if (sms_dbg & lvl) \ | 1178 | if (sms_dbg & lvl) \ |
763 | sms_printk(kern, fmt, ##arg); } while (0) | 1179 | sms_printk(kern, fmt, ##arg); \ |
1180 | } while (0) | ||
764 | 1181 | ||
765 | #define sms_log(fmt, arg...) sms_printk(KERN_INFO, fmt, ##arg) | 1182 | #define sms_log(fmt, arg...) sms_printk(KERN_INFO, fmt, ##arg) |
766 | #define sms_err(fmt, arg...) \ | 1183 | #define sms_err(fmt, arg...) \ |
diff --git a/drivers/media/common/siano/smsdvb-debugfs.c b/drivers/media/common/siano/smsdvb-debugfs.c new file mode 100644 index 000000000000..0bb4430535f9 --- /dev/null +++ b/drivers/media/common/siano/smsdvb-debugfs.c | |||
@@ -0,0 +1,551 @@ | |||
1 | /*********************************************************************** | ||
2 | * | ||
3 | * Copyright(c) 2013 Mauro Carvalho Chehab <mchehab@redhat.com> | ||
4 | * | ||
5 | * This program is free software: you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation, either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | |||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | * | ||
18 | ***********************************************************************/ | ||
19 | |||
20 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
21 | |||
22 | #include <linux/module.h> | ||
23 | #include <linux/slab.h> | ||
24 | #include <linux/init.h> | ||
25 | #include <linux/debugfs.h> | ||
26 | #include <linux/spinlock.h> | ||
27 | #include <linux/usb.h> | ||
28 | |||
29 | #include "dmxdev.h" | ||
30 | #include "dvbdev.h" | ||
31 | #include "dvb_demux.h" | ||
32 | #include "dvb_frontend.h" | ||
33 | |||
34 | #include "smscoreapi.h" | ||
35 | |||
36 | #include "smsdvb.h" | ||
37 | |||
38 | static struct dentry *smsdvb_debugfs_usb_root; | ||
39 | |||
40 | struct smsdvb_debugfs { | ||
41 | struct kref refcount; | ||
42 | spinlock_t lock; | ||
43 | |||
44 | char stats_data[PAGE_SIZE]; | ||
45 | unsigned stats_count; | ||
46 | bool stats_was_read; | ||
47 | |||
48 | wait_queue_head_t stats_queue; | ||
49 | }; | ||
50 | |||
51 | static void smsdvb_print_dvb_stats(struct smsdvb_debugfs *debug_data, | ||
52 | struct sms_stats *p) | ||
53 | { | ||
54 | int n = 0; | ||
55 | char *buf; | ||
56 | |||
57 | spin_lock(&debug_data->lock); | ||
58 | if (debug_data->stats_count) { | ||
59 | spin_unlock(&debug_data->lock); | ||
60 | return; | ||
61 | } | ||
62 | |||
63 | buf = debug_data->stats_data; | ||
64 | |||
65 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
66 | "is_rf_locked = %d\n", p->is_rf_locked); | ||
67 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
68 | "is_demod_locked = %d\n", p->is_demod_locked); | ||
69 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
70 | "is_external_lna_on = %d\n", p->is_external_lna_on); | ||
71 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
72 | "SNR = %d\n", p->SNR); | ||
73 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
74 | "ber = %d\n", p->ber); | ||
75 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
76 | "FIB_CRC = %d\n", p->FIB_CRC); | ||
77 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
78 | "ts_per = %d\n", p->ts_per); | ||
79 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
80 | "MFER = %d\n", p->MFER); | ||
81 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
82 | "RSSI = %d\n", p->RSSI); | ||
83 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
84 | "in_band_pwr = %d\n", p->in_band_pwr); | ||
85 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
86 | "carrier_offset = %d\n", p->carrier_offset); | ||
87 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
88 | "modem_state = %d\n", p->modem_state); | ||
89 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
90 | "frequency = %d\n", p->frequency); | ||
91 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
92 | "bandwidth = %d\n", p->bandwidth); | ||
93 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
94 | "transmission_mode = %d\n", p->transmission_mode); | ||
95 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
96 | "modem_state = %d\n", p->modem_state); | ||
97 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
98 | "guard_interval = %d\n", p->guard_interval); | ||
99 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
100 | "code_rate = %d\n", p->code_rate); | ||
101 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
102 | "lp_code_rate = %d\n", p->lp_code_rate); | ||
103 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
104 | "hierarchy = %d\n", p->hierarchy); | ||
105 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
106 | "constellation = %d\n", p->constellation); | ||
107 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
108 | "burst_size = %d\n", p->burst_size); | ||
109 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
110 | "burst_duration = %d\n", p->burst_duration); | ||
111 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
112 | "burst_cycle_time = %d\n", p->burst_cycle_time); | ||
113 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
114 | "calc_burst_cycle_time = %d\n", | ||
115 | p->calc_burst_cycle_time); | ||
116 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
117 | "num_of_rows = %d\n", p->num_of_rows); | ||
118 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
119 | "num_of_padd_cols = %d\n", p->num_of_padd_cols); | ||
120 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
121 | "num_of_punct_cols = %d\n", p->num_of_punct_cols); | ||
122 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
123 | "error_ts_packets = %d\n", p->error_ts_packets); | ||
124 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
125 | "total_ts_packets = %d\n", p->total_ts_packets); | ||
126 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
127 | "num_of_valid_mpe_tlbs = %d\n", p->num_of_valid_mpe_tlbs); | ||
128 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
129 | "num_of_invalid_mpe_tlbs = %d\n", p->num_of_invalid_mpe_tlbs); | ||
130 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
131 | "num_of_corrected_mpe_tlbs = %d\n", p->num_of_corrected_mpe_tlbs); | ||
132 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
133 | "ber_error_count = %d\n", p->ber_error_count); | ||
134 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
135 | "ber_bit_count = %d\n", p->ber_bit_count); | ||
136 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
137 | "sms_to_host_tx_errors = %d\n", p->sms_to_host_tx_errors); | ||
138 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
139 | "pre_ber = %d\n", p->pre_ber); | ||
140 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
141 | "cell_id = %d\n", p->cell_id); | ||
142 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
143 | "dvbh_srv_ind_hp = %d\n", p->dvbh_srv_ind_hp); | ||
144 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
145 | "dvbh_srv_ind_lp = %d\n", p->dvbh_srv_ind_lp); | ||
146 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
147 | "num_mpe_received = %d\n", p->num_mpe_received); | ||
148 | |||
149 | debug_data->stats_count = n; | ||
150 | spin_unlock(&debug_data->lock); | ||
151 | wake_up(&debug_data->stats_queue); | ||
152 | } | ||
153 | |||
154 | static void smsdvb_print_isdb_stats(struct smsdvb_debugfs *debug_data, | ||
155 | struct sms_isdbt_stats *p) | ||
156 | { | ||
157 | int i, n = 0; | ||
158 | char *buf; | ||
159 | |||
160 | spin_lock(&debug_data->lock); | ||
161 | if (debug_data->stats_count) { | ||
162 | spin_unlock(&debug_data->lock); | ||
163 | return; | ||
164 | } | ||
165 | |||
166 | buf = debug_data->stats_data; | ||
167 | |||
168 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
169 | "statistics_type = %d\t", p->statistics_type); | ||
170 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
171 | "full_size = %d\n", p->full_size); | ||
172 | |||
173 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
174 | "is_rf_locked = %d\t\t", p->is_rf_locked); | ||
175 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
176 | "is_demod_locked = %d\t", p->is_demod_locked); | ||
177 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
178 | "is_external_lna_on = %d\n", p->is_external_lna_on); | ||
179 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
180 | "SNR = %d dB\t\t", p->SNR); | ||
181 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
182 | "RSSI = %d dBm\t\t", p->RSSI); | ||
183 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
184 | "in_band_pwr = %d dBm\n", p->in_band_pwr); | ||
185 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
186 | "carrier_offset = %d\t", p->carrier_offset); | ||
187 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
188 | "bandwidth = %d\t\t", p->bandwidth); | ||
189 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
190 | "frequency = %d Hz\n", p->frequency); | ||
191 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
192 | "transmission_mode = %d\t", p->transmission_mode); | ||
193 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
194 | "modem_state = %d\t\t", p->modem_state); | ||
195 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
196 | "guard_interval = %d\n", p->guard_interval); | ||
197 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
198 | "system_type = %d\t\t", p->system_type); | ||
199 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
200 | "partial_reception = %d\t", p->partial_reception); | ||
201 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
202 | "num_of_layers = %d\n", p->num_of_layers); | ||
203 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
204 | "sms_to_host_tx_errors = %d\n", p->sms_to_host_tx_errors); | ||
205 | |||
206 | for (i = 0; i < 3; i++) { | ||
207 | if (p->layer_info[i].number_of_segments < 1 || | ||
208 | p->layer_info[i].number_of_segments > 13) | ||
209 | continue; | ||
210 | |||
211 | n += snprintf(&buf[n], PAGE_SIZE - n, "\nLayer %d\n", i); | ||
212 | n += snprintf(&buf[n], PAGE_SIZE - n, "\tcode_rate = %d\t", | ||
213 | p->layer_info[i].code_rate); | ||
214 | n += snprintf(&buf[n], PAGE_SIZE - n, "constellation = %d\n", | ||
215 | p->layer_info[i].constellation); | ||
216 | n += snprintf(&buf[n], PAGE_SIZE - n, "\tber = %-5d\t", | ||
217 | p->layer_info[i].ber); | ||
218 | n += snprintf(&buf[n], PAGE_SIZE - n, "\tber_error_count = %-5d\t", | ||
219 | p->layer_info[i].ber_error_count); | ||
220 | n += snprintf(&buf[n], PAGE_SIZE - n, "ber_bit_count = %-5d\n", | ||
221 | p->layer_info[i].ber_bit_count); | ||
222 | n += snprintf(&buf[n], PAGE_SIZE - n, "\tpre_ber = %-5d\t", | ||
223 | p->layer_info[i].pre_ber); | ||
224 | n += snprintf(&buf[n], PAGE_SIZE - n, "\tts_per = %-5d\n", | ||
225 | p->layer_info[i].ts_per); | ||
226 | n += snprintf(&buf[n], PAGE_SIZE - n, "\terror_ts_packets = %-5d\t", | ||
227 | p->layer_info[i].error_ts_packets); | ||
228 | n += snprintf(&buf[n], PAGE_SIZE - n, "total_ts_packets = %-5d\t", | ||
229 | p->layer_info[i].total_ts_packets); | ||
230 | n += snprintf(&buf[n], PAGE_SIZE - n, "ti_ldepth_i = %d\n", | ||
231 | p->layer_info[i].ti_ldepth_i); | ||
232 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
233 | "\tnumber_of_segments = %d\t", | ||
234 | p->layer_info[i].number_of_segments); | ||
235 | n += snprintf(&buf[n], PAGE_SIZE - n, "tmcc_errors = %d\n", | ||
236 | p->layer_info[i].tmcc_errors); | ||
237 | } | ||
238 | |||
239 | debug_data->stats_count = n; | ||
240 | spin_unlock(&debug_data->lock); | ||
241 | wake_up(&debug_data->stats_queue); | ||
242 | } | ||
243 | |||
244 | static void smsdvb_print_isdb_stats_ex(struct smsdvb_debugfs *debug_data, | ||
245 | struct sms_isdbt_stats_ex *p) | ||
246 | { | ||
247 | int i, n = 0; | ||
248 | char *buf; | ||
249 | |||
250 | spin_lock(&debug_data->lock); | ||
251 | if (debug_data->stats_count) { | ||
252 | spin_unlock(&debug_data->lock); | ||
253 | return; | ||
254 | } | ||
255 | |||
256 | buf = debug_data->stats_data; | ||
257 | |||
258 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
259 | "statistics_type = %d\t", p->statistics_type); | ||
260 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
261 | "full_size = %d\n", p->full_size); | ||
262 | |||
263 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
264 | "is_rf_locked = %d\t\t", p->is_rf_locked); | ||
265 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
266 | "is_demod_locked = %d\t", p->is_demod_locked); | ||
267 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
268 | "is_external_lna_on = %d\n", p->is_external_lna_on); | ||
269 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
270 | "SNR = %d dB\t\t", p->SNR); | ||
271 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
272 | "RSSI = %d dBm\t\t", p->RSSI); | ||
273 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
274 | "in_band_pwr = %d dBm\n", p->in_band_pwr); | ||
275 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
276 | "carrier_offset = %d\t", p->carrier_offset); | ||
277 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
278 | "bandwidth = %d\t\t", p->bandwidth); | ||
279 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
280 | "frequency = %d Hz\n", p->frequency); | ||
281 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
282 | "transmission_mode = %d\t", p->transmission_mode); | ||
283 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
284 | "modem_state = %d\t\t", p->modem_state); | ||
285 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
286 | "guard_interval = %d\n", p->guard_interval); | ||
287 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
288 | "system_type = %d\t\t", p->system_type); | ||
289 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
290 | "partial_reception = %d\t", p->partial_reception); | ||
291 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
292 | "num_of_layers = %d\n", p->num_of_layers); | ||
293 | n += snprintf(&buf[n], PAGE_SIZE - n, "segment_number = %d\t", | ||
294 | p->segment_number); | ||
295 | n += snprintf(&buf[n], PAGE_SIZE - n, "tune_bw = %d\n", | ||
296 | p->tune_bw); | ||
297 | |||
298 | for (i = 0; i < 3; i++) { | ||
299 | if (p->layer_info[i].number_of_segments < 1 || | ||
300 | p->layer_info[i].number_of_segments > 13) | ||
301 | continue; | ||
302 | |||
303 | n += snprintf(&buf[n], PAGE_SIZE - n, "\nLayer %d\n", i); | ||
304 | n += snprintf(&buf[n], PAGE_SIZE - n, "\tcode_rate = %d\t", | ||
305 | p->layer_info[i].code_rate); | ||
306 | n += snprintf(&buf[n], PAGE_SIZE - n, "constellation = %d\n", | ||
307 | p->layer_info[i].constellation); | ||
308 | n += snprintf(&buf[n], PAGE_SIZE - n, "\tber = %-5d\t", | ||
309 | p->layer_info[i].ber); | ||
310 | n += snprintf(&buf[n], PAGE_SIZE - n, "\tber_error_count = %-5d\t", | ||
311 | p->layer_info[i].ber_error_count); | ||
312 | n += snprintf(&buf[n], PAGE_SIZE - n, "ber_bit_count = %-5d\n", | ||
313 | p->layer_info[i].ber_bit_count); | ||
314 | n += snprintf(&buf[n], PAGE_SIZE - n, "\tpre_ber = %-5d\t", | ||
315 | p->layer_info[i].pre_ber); | ||
316 | n += snprintf(&buf[n], PAGE_SIZE - n, "\tts_per = %-5d\n", | ||
317 | p->layer_info[i].ts_per); | ||
318 | n += snprintf(&buf[n], PAGE_SIZE - n, "\terror_ts_packets = %-5d\t", | ||
319 | p->layer_info[i].error_ts_packets); | ||
320 | n += snprintf(&buf[n], PAGE_SIZE - n, "total_ts_packets = %-5d\t", | ||
321 | p->layer_info[i].total_ts_packets); | ||
322 | n += snprintf(&buf[n], PAGE_SIZE - n, "ti_ldepth_i = %d\n", | ||
323 | p->layer_info[i].ti_ldepth_i); | ||
324 | n += snprintf(&buf[n], PAGE_SIZE - n, | ||
325 | "\tnumber_of_segments = %d\t", | ||
326 | p->layer_info[i].number_of_segments); | ||
327 | n += snprintf(&buf[n], PAGE_SIZE - n, "tmcc_errors = %d\n", | ||
328 | p->layer_info[i].tmcc_errors); | ||
329 | } | ||
330 | |||
331 | |||
332 | debug_data->stats_count = n; | ||
333 | spin_unlock(&debug_data->lock); | ||
334 | |||
335 | wake_up(&debug_data->stats_queue); | ||
336 | } | ||
337 | |||
338 | static int smsdvb_stats_open(struct inode *inode, struct file *file) | ||
339 | { | ||
340 | struct smsdvb_client_t *client = inode->i_private; | ||
341 | struct smsdvb_debugfs *debug_data = client->debug_data; | ||
342 | |||
343 | kref_get(&debug_data->refcount); | ||
344 | |||
345 | spin_lock(&debug_data->lock); | ||
346 | debug_data->stats_count = 0; | ||
347 | debug_data->stats_was_read = false; | ||
348 | spin_unlock(&debug_data->lock); | ||
349 | |||
350 | file->private_data = debug_data; | ||
351 | |||
352 | return 0; | ||
353 | } | ||
354 | |||
355 | static void smsdvb_debugfs_data_release(struct kref *ref) | ||
356 | { | ||
357 | struct smsdvb_debugfs *debug_data; | ||
358 | |||
359 | debug_data = container_of(ref, struct smsdvb_debugfs, refcount); | ||
360 | kfree(debug_data); | ||
361 | } | ||
362 | |||
363 | static int smsdvb_stats_wait_read(struct smsdvb_debugfs *debug_data) | ||
364 | { | ||
365 | int rc = 1; | ||
366 | |||
367 | spin_lock(&debug_data->lock); | ||
368 | |||
369 | if (debug_data->stats_was_read) | ||
370 | goto exit; | ||
371 | |||
372 | rc = debug_data->stats_count; | ||
373 | |||
374 | exit: | ||
375 | spin_unlock(&debug_data->lock); | ||
376 | return rc; | ||
377 | } | ||
378 | |||
379 | static unsigned int smsdvb_stats_poll(struct file *file, poll_table *wait) | ||
380 | { | ||
381 | struct smsdvb_debugfs *debug_data = file->private_data; | ||
382 | int rc; | ||
383 | |||
384 | kref_get(&debug_data->refcount); | ||
385 | |||
386 | poll_wait(file, &debug_data->stats_queue, wait); | ||
387 | |||
388 | rc = smsdvb_stats_wait_read(debug_data); | ||
389 | if (rc > 0) | ||
390 | rc = POLLIN | POLLRDNORM; | ||
391 | |||
392 | kref_put(&debug_data->refcount, smsdvb_debugfs_data_release); | ||
393 | |||
394 | return rc; | ||
395 | } | ||
396 | |||
397 | static ssize_t smsdvb_stats_read(struct file *file, char __user *user_buf, | ||
398 | size_t nbytes, loff_t *ppos) | ||
399 | { | ||
400 | int rc = 0, len; | ||
401 | struct smsdvb_debugfs *debug_data = file->private_data; | ||
402 | |||
403 | kref_get(&debug_data->refcount); | ||
404 | |||
405 | if (file->f_flags & O_NONBLOCK) { | ||
406 | rc = smsdvb_stats_wait_read(debug_data); | ||
407 | if (!rc) { | ||
408 | rc = -EWOULDBLOCK; | ||
409 | goto ret; | ||
410 | } | ||
411 | } else { | ||
412 | rc = wait_event_interruptible(debug_data->stats_queue, | ||
413 | smsdvb_stats_wait_read(debug_data)); | ||
414 | if (rc < 0) | ||
415 | goto ret; | ||
416 | } | ||
417 | |||
418 | if (debug_data->stats_was_read) { | ||
419 | rc = 0; /* EOF */ | ||
420 | goto ret; | ||
421 | } | ||
422 | |||
423 | len = debug_data->stats_count - *ppos; | ||
424 | if (len >= 0) | ||
425 | rc = simple_read_from_buffer(user_buf, nbytes, ppos, | ||
426 | debug_data->stats_data, len); | ||
427 | else | ||
428 | rc = 0; | ||
429 | |||
430 | if (*ppos >= debug_data->stats_count) { | ||
431 | spin_lock(&debug_data->lock); | ||
432 | debug_data->stats_was_read = true; | ||
433 | spin_unlock(&debug_data->lock); | ||
434 | } | ||
435 | ret: | ||
436 | kref_put(&debug_data->refcount, smsdvb_debugfs_data_release); | ||
437 | return rc; | ||
438 | } | ||
439 | |||
440 | static int smsdvb_stats_release(struct inode *inode, struct file *file) | ||
441 | { | ||
442 | struct smsdvb_debugfs *debug_data = file->private_data; | ||
443 | |||
444 | spin_lock(&debug_data->lock); | ||
445 | debug_data->stats_was_read = true; /* return EOF to read() */ | ||
446 | spin_unlock(&debug_data->lock); | ||
447 | wake_up_interruptible_sync(&debug_data->stats_queue); | ||
448 | |||
449 | kref_put(&debug_data->refcount, smsdvb_debugfs_data_release); | ||
450 | file->private_data = NULL; | ||
451 | |||
452 | return 0; | ||
453 | } | ||
454 | |||
455 | static const struct file_operations debugfs_stats_ops = { | ||
456 | .open = smsdvb_stats_open, | ||
457 | .poll = smsdvb_stats_poll, | ||
458 | .read = smsdvb_stats_read, | ||
459 | .release = smsdvb_stats_release, | ||
460 | .llseek = generic_file_llseek, | ||
461 | }; | ||
462 | |||
463 | /* | ||
464 | * Functions used by smsdvb, in order to create the interfaces | ||
465 | */ | ||
466 | |||
467 | int smsdvb_debugfs_create(struct smsdvb_client_t *client) | ||
468 | { | ||
469 | struct smscore_device_t *coredev = client->coredev; | ||
470 | struct dentry *d; | ||
471 | struct smsdvb_debugfs *debug_data; | ||
472 | |||
473 | if (!smsdvb_debugfs_usb_root || !coredev->is_usb_device) | ||
474 | return -ENODEV; | ||
475 | |||
476 | client->debugfs = debugfs_create_dir(coredev->devpath, | ||
477 | smsdvb_debugfs_usb_root); | ||
478 | if (IS_ERR_OR_NULL(client->debugfs)) { | ||
479 | pr_info("Unable to create debugfs %s directory.\n", | ||
480 | coredev->devpath); | ||
481 | return -ENODEV; | ||
482 | } | ||
483 | |||
484 | d = debugfs_create_file("stats", S_IRUGO | S_IWUSR, client->debugfs, | ||
485 | client, &debugfs_stats_ops); | ||
486 | if (!d) { | ||
487 | debugfs_remove(client->debugfs); | ||
488 | return -ENOMEM; | ||
489 | } | ||
490 | |||
491 | debug_data = kzalloc(sizeof(*client->debug_data), GFP_KERNEL); | ||
492 | if (!debug_data) | ||
493 | return -ENOMEM; | ||
494 | |||
495 | client->debug_data = debug_data; | ||
496 | client->prt_dvb_stats = smsdvb_print_dvb_stats; | ||
497 | client->prt_isdb_stats = smsdvb_print_isdb_stats; | ||
498 | client->prt_isdb_stats_ex = smsdvb_print_isdb_stats_ex; | ||
499 | |||
500 | init_waitqueue_head(&debug_data->stats_queue); | ||
501 | spin_lock_init(&debug_data->lock); | ||
502 | kref_init(&debug_data->refcount); | ||
503 | |||
504 | return 0; | ||
505 | } | ||
506 | |||
507 | void smsdvb_debugfs_release(struct smsdvb_client_t *client) | ||
508 | { | ||
509 | if (!client->debugfs) | ||
510 | return; | ||
511 | |||
512 | client->prt_dvb_stats = NULL; | ||
513 | client->prt_isdb_stats = NULL; | ||
514 | client->prt_isdb_stats_ex = NULL; | ||
515 | |||
516 | debugfs_remove_recursive(client->debugfs); | ||
517 | kref_put(&client->debug_data->refcount, smsdvb_debugfs_data_release); | ||
518 | |||
519 | client->debug_data = NULL; | ||
520 | client->debugfs = NULL; | ||
521 | } | ||
522 | |||
523 | int smsdvb_debugfs_register(void) | ||
524 | { | ||
525 | struct dentry *d; | ||
526 | |||
527 | /* | ||
528 | * FIXME: This was written to debug Siano USB devices. So, it creates | ||
529 | * the debugfs node under <debugfs>/usb. | ||
530 | * A similar logic would be needed for Siano sdio devices, but, in that | ||
531 | * case, usb_debug_root is not a good choice. | ||
532 | * | ||
533 | * Perhaps the right fix here would be to create another sysfs root | ||
534 | * node for sdio-based boards, but this may need some logic at sdio | ||
535 | * subsystem. | ||
536 | */ | ||
537 | d = debugfs_create_dir("smsdvb", usb_debug_root); | ||
538 | if (IS_ERR_OR_NULL(d)) { | ||
539 | sms_err("Couldn't create sysfs node for smsdvb"); | ||
540 | return PTR_ERR(d); | ||
541 | } else { | ||
542 | smsdvb_debugfs_usb_root = d; | ||
543 | } | ||
544 | return 0; | ||
545 | } | ||
546 | |||
547 | void smsdvb_debugfs_unregister(void) | ||
548 | { | ||
549 | debugfs_remove_recursive(smsdvb_debugfs_usb_root); | ||
550 | smsdvb_debugfs_usb_root = NULL; | ||
551 | } | ||
diff --git a/drivers/media/common/siano/smsdvb-main.c b/drivers/media/common/siano/smsdvb-main.c new file mode 100644 index 000000000000..297f1b2f9a32 --- /dev/null +++ b/drivers/media/common/siano/smsdvb-main.c | |||
@@ -0,0 +1,1230 @@ | |||
1 | /**************************************************************** | ||
2 | |||
3 | Siano Mobile Silicon, Inc. | ||
4 | MDTV receiver kernel modules. | ||
5 | Copyright (C) 2006-2008, Uri Shkolnik | ||
6 | |||
7 | This program is free software: you can redistribute it and/or modify | ||
8 | it under the terms of the GNU General Public License as published by | ||
9 | the Free Software Foundation, either version 2 of the License, or | ||
10 | (at your option) any later version. | ||
11 | |||
12 | This program is distributed in the hope that it will be useful, | ||
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | GNU General Public License for more details. | ||
16 | |||
17 | You should have received a copy of the GNU General Public License | ||
18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
19 | |||
20 | ****************************************************************/ | ||
21 | |||
22 | #include <linux/module.h> | ||
23 | #include <linux/slab.h> | ||
24 | #include <linux/init.h> | ||
25 | #include <asm/div64.h> | ||
26 | |||
27 | #include "dmxdev.h" | ||
28 | #include "dvbdev.h" | ||
29 | #include "dvb_demux.h" | ||
30 | #include "dvb_frontend.h" | ||
31 | |||
32 | #include "smscoreapi.h" | ||
33 | #include "sms-cards.h" | ||
34 | |||
35 | #include "smsdvb.h" | ||
36 | |||
37 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); | ||
38 | |||
39 | static struct list_head g_smsdvb_clients; | ||
40 | static struct mutex g_smsdvb_clientslock; | ||
41 | |||
42 | static int sms_dbg; | ||
43 | module_param_named(debug, sms_dbg, int, 0644); | ||
44 | MODULE_PARM_DESC(debug, "set debug level (info=1, adv=2 (or-able))"); | ||
45 | |||
46 | |||
47 | u32 sms_to_guard_interval_table[] = { | ||
48 | [0] = GUARD_INTERVAL_1_32, | ||
49 | [1] = GUARD_INTERVAL_1_16, | ||
50 | [2] = GUARD_INTERVAL_1_8, | ||
51 | [3] = GUARD_INTERVAL_1_4, | ||
52 | }; | ||
53 | |||
54 | u32 sms_to_code_rate_table[] = { | ||
55 | [0] = FEC_1_2, | ||
56 | [1] = FEC_2_3, | ||
57 | [2] = FEC_3_4, | ||
58 | [3] = FEC_5_6, | ||
59 | [4] = FEC_7_8, | ||
60 | }; | ||
61 | |||
62 | |||
63 | u32 sms_to_hierarchy_table[] = { | ||
64 | [0] = HIERARCHY_NONE, | ||
65 | [1] = HIERARCHY_1, | ||
66 | [2] = HIERARCHY_2, | ||
67 | [3] = HIERARCHY_4, | ||
68 | }; | ||
69 | |||
70 | u32 sms_to_modulation_table[] = { | ||
71 | [0] = QPSK, | ||
72 | [1] = QAM_16, | ||
73 | [2] = QAM_64, | ||
74 | [3] = DQPSK, | ||
75 | }; | ||
76 | |||
77 | |||
78 | /* Events that may come from DVB v3 adapter */ | ||
79 | static void sms_board_dvb3_event(struct smsdvb_client_t *client, | ||
80 | enum SMS_DVB3_EVENTS event) { | ||
81 | |||
82 | struct smscore_device_t *coredev = client->coredev; | ||
83 | switch (event) { | ||
84 | case DVB3_EVENT_INIT: | ||
85 | sms_debug("DVB3_EVENT_INIT"); | ||
86 | sms_board_event(coredev, BOARD_EVENT_BIND); | ||
87 | break; | ||
88 | case DVB3_EVENT_SLEEP: | ||
89 | sms_debug("DVB3_EVENT_SLEEP"); | ||
90 | sms_board_event(coredev, BOARD_EVENT_POWER_SUSPEND); | ||
91 | break; | ||
92 | case DVB3_EVENT_HOTPLUG: | ||
93 | sms_debug("DVB3_EVENT_HOTPLUG"); | ||
94 | sms_board_event(coredev, BOARD_EVENT_POWER_INIT); | ||
95 | break; | ||
96 | case DVB3_EVENT_FE_LOCK: | ||
97 | if (client->event_fe_state != DVB3_EVENT_FE_LOCK) { | ||
98 | client->event_fe_state = DVB3_EVENT_FE_LOCK; | ||
99 | sms_debug("DVB3_EVENT_FE_LOCK"); | ||
100 | sms_board_event(coredev, BOARD_EVENT_FE_LOCK); | ||
101 | } | ||
102 | break; | ||
103 | case DVB3_EVENT_FE_UNLOCK: | ||
104 | if (client->event_fe_state != DVB3_EVENT_FE_UNLOCK) { | ||
105 | client->event_fe_state = DVB3_EVENT_FE_UNLOCK; | ||
106 | sms_debug("DVB3_EVENT_FE_UNLOCK"); | ||
107 | sms_board_event(coredev, BOARD_EVENT_FE_UNLOCK); | ||
108 | } | ||
109 | break; | ||
110 | case DVB3_EVENT_UNC_OK: | ||
111 | if (client->event_unc_state != DVB3_EVENT_UNC_OK) { | ||
112 | client->event_unc_state = DVB3_EVENT_UNC_OK; | ||
113 | sms_debug("DVB3_EVENT_UNC_OK"); | ||
114 | sms_board_event(coredev, BOARD_EVENT_MULTIPLEX_OK); | ||
115 | } | ||
116 | break; | ||
117 | case DVB3_EVENT_UNC_ERR: | ||
118 | if (client->event_unc_state != DVB3_EVENT_UNC_ERR) { | ||
119 | client->event_unc_state = DVB3_EVENT_UNC_ERR; | ||
120 | sms_debug("DVB3_EVENT_UNC_ERR"); | ||
121 | sms_board_event(coredev, BOARD_EVENT_MULTIPLEX_ERRORS); | ||
122 | } | ||
123 | break; | ||
124 | |||
125 | default: | ||
126 | sms_err("Unknown dvb3 api event"); | ||
127 | break; | ||
128 | } | ||
129 | } | ||
130 | |||
131 | static void smsdvb_stats_not_ready(struct dvb_frontend *fe) | ||
132 | { | ||
133 | struct smsdvb_client_t *client = | ||
134 | container_of(fe, struct smsdvb_client_t, frontend); | ||
135 | struct smscore_device_t *coredev = client->coredev; | ||
136 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; | ||
137 | int i, n_layers; | ||
138 | |||
139 | switch (smscore_get_device_mode(coredev)) { | ||
140 | case DEVICE_MODE_ISDBT: | ||
141 | case DEVICE_MODE_ISDBT_BDA: | ||
142 | n_layers = 4; | ||
143 | default: | ||
144 | n_layers = 1; | ||
145 | } | ||
146 | |||
147 | /* Global stats */ | ||
148 | c->strength.len = 1; | ||
149 | c->cnr.len = 1; | ||
150 | c->strength.stat[0].scale = FE_SCALE_DECIBEL; | ||
151 | c->cnr.stat[0].scale = FE_SCALE_DECIBEL; | ||
152 | |||
153 | /* Per-layer stats */ | ||
154 | c->post_bit_error.len = n_layers; | ||
155 | c->post_bit_count.len = n_layers; | ||
156 | c->block_error.len = n_layers; | ||
157 | c->block_count.len = n_layers; | ||
158 | |||
159 | /* | ||
160 | * Put all of them at FE_SCALE_NOT_AVAILABLE. They're dynamically | ||
161 | * changed when the stats become available. | ||
162 | */ | ||
163 | for (i = 0; i < n_layers; i++) { | ||
164 | c->post_bit_error.stat[i].scale = FE_SCALE_NOT_AVAILABLE; | ||
165 | c->post_bit_count.stat[i].scale = FE_SCALE_NOT_AVAILABLE; | ||
166 | c->block_error.stat[i].scale = FE_SCALE_NOT_AVAILABLE; | ||
167 | c->block_count.stat[i].scale = FE_SCALE_NOT_AVAILABLE; | ||
168 | } | ||
169 | } | ||
170 | |||
171 | static inline int sms_to_mode(u32 mode) | ||
172 | { | ||
173 | switch (mode) { | ||
174 | case 2: | ||
175 | return TRANSMISSION_MODE_2K; | ||
176 | case 4: | ||
177 | return TRANSMISSION_MODE_4K; | ||
178 | case 8: | ||
179 | return TRANSMISSION_MODE_8K; | ||
180 | } | ||
181 | return TRANSMISSION_MODE_AUTO; | ||
182 | } | ||
183 | |||
184 | static inline int sms_to_status(u32 is_demod_locked, u32 is_rf_locked) | ||
185 | { | ||
186 | if (is_demod_locked) | ||
187 | return FE_HAS_SIGNAL | FE_HAS_CARRIER | FE_HAS_VITERBI | | ||
188 | FE_HAS_SYNC | FE_HAS_LOCK; | ||
189 | |||
190 | if (is_rf_locked) | ||
191 | return FE_HAS_SIGNAL | FE_HAS_CARRIER; | ||
192 | |||
193 | return 0; | ||
194 | } | ||
195 | |||
196 | static inline u32 sms_to_bw(u32 value) | ||
197 | { | ||
198 | return value * 1000000; | ||
199 | } | ||
200 | |||
201 | #define convert_from_table(value, table, defval) ({ \ | ||
202 | u32 __ret; \ | ||
203 | if (value < ARRAY_SIZE(table)) \ | ||
204 | __ret = table[value]; \ | ||
205 | else \ | ||
206 | __ret = defval; \ | ||
207 | __ret; \ | ||
208 | }) | ||
209 | |||
210 | #define sms_to_guard_interval(value) \ | ||
211 | convert_from_table(value, sms_to_guard_interval_table, \ | ||
212 | GUARD_INTERVAL_AUTO); | ||
213 | |||
214 | #define sms_to_code_rate(value) \ | ||
215 | convert_from_table(value, sms_to_code_rate_table, \ | ||
216 | FEC_NONE); | ||
217 | |||
218 | #define sms_to_hierarchy(value) \ | ||
219 | convert_from_table(value, sms_to_hierarchy_table, \ | ||
220 | FEC_NONE); | ||
221 | |||
222 | #define sms_to_modulation(value) \ | ||
223 | convert_from_table(value, sms_to_modulation_table, \ | ||
224 | FEC_NONE); | ||
225 | |||
226 | static void smsdvb_update_tx_params(struct smsdvb_client_t *client, | ||
227 | struct sms_tx_stats *p) | ||
228 | { | ||
229 | struct dvb_frontend *fe = &client->frontend; | ||
230 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; | ||
231 | |||
232 | c->frequency = p->frequency; | ||
233 | client->fe_status = sms_to_status(p->is_demod_locked, 0); | ||
234 | c->bandwidth_hz = sms_to_bw(p->bandwidth); | ||
235 | c->transmission_mode = sms_to_mode(p->transmission_mode); | ||
236 | c->guard_interval = sms_to_guard_interval(p->guard_interval); | ||
237 | c->code_rate_HP = sms_to_code_rate(p->code_rate); | ||
238 | c->code_rate_LP = sms_to_code_rate(p->lp_code_rate); | ||
239 | c->hierarchy = sms_to_hierarchy(p->hierarchy); | ||
240 | c->modulation = sms_to_modulation(p->constellation); | ||
241 | } | ||
242 | |||
243 | static void smsdvb_update_per_slices(struct smsdvb_client_t *client, | ||
244 | struct RECEPTION_STATISTICS_PER_SLICES_S *p) | ||
245 | { | ||
246 | struct dvb_frontend *fe = &client->frontend; | ||
247 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; | ||
248 | u64 tmp; | ||
249 | |||
250 | client->fe_status = sms_to_status(p->is_demod_locked, p->is_rf_locked); | ||
251 | c->modulation = sms_to_modulation(p->constellation); | ||
252 | |||
253 | /* signal Strength, in DBm */ | ||
254 | c->strength.stat[0].uvalue = p->in_band_power * 1000; | ||
255 | |||
256 | /* Carrier to noise ratio, in DB */ | ||
257 | c->cnr.stat[0].svalue = p->snr * 1000; | ||
258 | |||
259 | /* PER/BER requires demod lock */ | ||
260 | if (!p->is_demod_locked) | ||
261 | return; | ||
262 | |||
263 | /* TS PER */ | ||
264 | client->last_per = c->block_error.stat[0].uvalue; | ||
265 | c->block_error.stat[0].scale = FE_SCALE_COUNTER; | ||
266 | c->block_count.stat[0].scale = FE_SCALE_COUNTER; | ||
267 | c->block_error.stat[0].uvalue += p->ets_packets; | ||
268 | c->block_count.stat[0].uvalue += p->ets_packets + p->ts_packets; | ||
269 | |||
270 | /* ber */ | ||
271 | c->post_bit_error.stat[0].scale = FE_SCALE_COUNTER; | ||
272 | c->post_bit_count.stat[0].scale = FE_SCALE_COUNTER; | ||
273 | c->post_bit_error.stat[0].uvalue += p->ber_error_count; | ||
274 | c->post_bit_count.stat[0].uvalue += p->ber_bit_count; | ||
275 | |||
276 | /* Legacy PER/BER */ | ||
277 | tmp = p->ets_packets * 65535; | ||
278 | do_div(tmp, p->ts_packets + p->ets_packets); | ||
279 | client->legacy_per = tmp; | ||
280 | } | ||
281 | |||
282 | static void smsdvb_update_dvb_stats(struct smsdvb_client_t *client, | ||
283 | struct sms_stats *p) | ||
284 | { | ||
285 | struct dvb_frontend *fe = &client->frontend; | ||
286 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; | ||
287 | |||
288 | if (client->prt_dvb_stats) | ||
289 | client->prt_dvb_stats(client->debug_data, p); | ||
290 | |||
291 | client->fe_status = sms_to_status(p->is_demod_locked, p->is_rf_locked); | ||
292 | |||
293 | /* Update DVB modulation parameters */ | ||
294 | c->frequency = p->frequency; | ||
295 | client->fe_status = sms_to_status(p->is_demod_locked, 0); | ||
296 | c->bandwidth_hz = sms_to_bw(p->bandwidth); | ||
297 | c->transmission_mode = sms_to_mode(p->transmission_mode); | ||
298 | c->guard_interval = sms_to_guard_interval(p->guard_interval); | ||
299 | c->code_rate_HP = sms_to_code_rate(p->code_rate); | ||
300 | c->code_rate_LP = sms_to_code_rate(p->lp_code_rate); | ||
301 | c->hierarchy = sms_to_hierarchy(p->hierarchy); | ||
302 | c->modulation = sms_to_modulation(p->constellation); | ||
303 | |||
304 | /* update reception data */ | ||
305 | c->lna = p->is_external_lna_on ? 1 : 0; | ||
306 | |||
307 | /* Carrier to noise ratio, in DB */ | ||
308 | c->cnr.stat[0].svalue = p->SNR * 1000; | ||
309 | |||
310 | /* signal Strength, in DBm */ | ||
311 | c->strength.stat[0].uvalue = p->in_band_pwr * 1000; | ||
312 | |||
313 | /* PER/BER requires demod lock */ | ||
314 | if (!p->is_demod_locked) | ||
315 | return; | ||
316 | |||
317 | /* TS PER */ | ||
318 | client->last_per = c->block_error.stat[0].uvalue; | ||
319 | c->block_error.stat[0].scale = FE_SCALE_COUNTER; | ||
320 | c->block_count.stat[0].scale = FE_SCALE_COUNTER; | ||
321 | c->block_error.stat[0].uvalue += p->error_ts_packets; | ||
322 | c->block_count.stat[0].uvalue += p->total_ts_packets; | ||
323 | |||
324 | /* ber */ | ||
325 | c->post_bit_error.stat[0].scale = FE_SCALE_COUNTER; | ||
326 | c->post_bit_count.stat[0].scale = FE_SCALE_COUNTER; | ||
327 | c->post_bit_error.stat[0].uvalue += p->ber_error_count; | ||
328 | c->post_bit_count.stat[0].uvalue += p->ber_bit_count; | ||
329 | |||
330 | /* Legacy PER/BER */ | ||
331 | client->legacy_ber = p->ber; | ||
332 | }; | ||
333 | |||
334 | static void smsdvb_update_isdbt_stats(struct smsdvb_client_t *client, | ||
335 | struct sms_isdbt_stats *p) | ||
336 | { | ||
337 | struct dvb_frontend *fe = &client->frontend; | ||
338 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; | ||
339 | struct sms_isdbt_layer_stats *lr; | ||
340 | int i, n_layers; | ||
341 | |||
342 | if (client->prt_isdb_stats) | ||
343 | client->prt_isdb_stats(client->debug_data, p); | ||
344 | |||
345 | client->fe_status = sms_to_status(p->is_demod_locked, p->is_rf_locked); | ||
346 | |||
347 | /* | ||
348 | * Firmware 2.1 seems to report only lock status and | ||
349 | * signal strength. The signal strength indicator is at the | ||
350 | * wrong field. | ||
351 | */ | ||
352 | if (p->statistics_type == 0) { | ||
353 | c->strength.stat[0].uvalue = ((s32)p->transmission_mode) * 1000; | ||
354 | c->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE; | ||
355 | return; | ||
356 | } | ||
357 | |||
358 | /* Update ISDB-T transmission parameters */ | ||
359 | c->frequency = p->frequency; | ||
360 | c->bandwidth_hz = sms_to_bw(p->bandwidth); | ||
361 | c->transmission_mode = sms_to_mode(p->transmission_mode); | ||
362 | c->guard_interval = sms_to_guard_interval(p->guard_interval); | ||
363 | c->isdbt_partial_reception = p->partial_reception ? 1 : 0; | ||
364 | n_layers = p->num_of_layers; | ||
365 | if (n_layers < 1) | ||
366 | n_layers = 1; | ||
367 | if (n_layers > 3) | ||
368 | n_layers = 3; | ||
369 | c->isdbt_layer_enabled = 0; | ||
370 | |||
371 | /* update reception data */ | ||
372 | c->lna = p->is_external_lna_on ? 1 : 0; | ||
373 | |||
374 | /* Carrier to noise ratio, in DB */ | ||
375 | c->cnr.stat[0].svalue = p->SNR * 1000; | ||
376 | |||
377 | /* signal Strength, in DBm */ | ||
378 | c->strength.stat[0].uvalue = p->in_band_pwr * 1000; | ||
379 | |||
380 | /* PER/BER and per-layer stats require demod lock */ | ||
381 | if (!p->is_demod_locked) | ||
382 | return; | ||
383 | |||
384 | client->last_per = c->block_error.stat[0].uvalue; | ||
385 | |||
386 | /* Clears global counters, as the code below will sum it again */ | ||
387 | c->block_error.stat[0].uvalue = 0; | ||
388 | c->block_count.stat[0].uvalue = 0; | ||
389 | c->block_error.stat[0].scale = FE_SCALE_COUNTER; | ||
390 | c->block_count.stat[0].scale = FE_SCALE_COUNTER; | ||
391 | c->post_bit_error.stat[0].uvalue = 0; | ||
392 | c->post_bit_count.stat[0].uvalue = 0; | ||
393 | c->post_bit_error.stat[0].scale = FE_SCALE_COUNTER; | ||
394 | c->post_bit_count.stat[0].scale = FE_SCALE_COUNTER; | ||
395 | |||
396 | for (i = 0; i < n_layers; i++) { | ||
397 | lr = &p->layer_info[i]; | ||
398 | |||
399 | /* Update per-layer transmission parameters */ | ||
400 | if (lr->number_of_segments > 0 && lr->number_of_segments < 13) { | ||
401 | c->isdbt_layer_enabled |= 1 << i; | ||
402 | c->layer[i].segment_count = lr->number_of_segments; | ||
403 | } else { | ||
404 | continue; | ||
405 | } | ||
406 | c->layer[i].modulation = sms_to_modulation(lr->constellation); | ||
407 | |||
408 | /* TS PER */ | ||
409 | c->block_error.stat[i + 1].scale = FE_SCALE_COUNTER; | ||
410 | c->block_count.stat[i + 1].scale = FE_SCALE_COUNTER; | ||
411 | c->block_error.stat[i + 1].uvalue += lr->error_ts_packets; | ||
412 | c->block_count.stat[i + 1].uvalue += lr->total_ts_packets; | ||
413 | |||
414 | /* Update global PER counter */ | ||
415 | c->block_error.stat[0].uvalue += lr->error_ts_packets; | ||
416 | c->block_count.stat[0].uvalue += lr->total_ts_packets; | ||
417 | |||
418 | /* BER */ | ||
419 | c->post_bit_error.stat[i + 1].scale = FE_SCALE_COUNTER; | ||
420 | c->post_bit_count.stat[i + 1].scale = FE_SCALE_COUNTER; | ||
421 | c->post_bit_error.stat[i + 1].uvalue += lr->ber_error_count; | ||
422 | c->post_bit_count.stat[i + 1].uvalue += lr->ber_bit_count; | ||
423 | |||
424 | /* Update global BER counter */ | ||
425 | c->post_bit_error.stat[0].uvalue += lr->ber_error_count; | ||
426 | c->post_bit_count.stat[0].uvalue += lr->ber_bit_count; | ||
427 | } | ||
428 | } | ||
429 | |||
430 | static void smsdvb_update_isdbt_stats_ex(struct smsdvb_client_t *client, | ||
431 | struct sms_isdbt_stats_ex *p) | ||
432 | { | ||
433 | struct dvb_frontend *fe = &client->frontend; | ||
434 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; | ||
435 | struct sms_isdbt_layer_stats *lr; | ||
436 | int i, n_layers; | ||
437 | |||
438 | if (client->prt_isdb_stats_ex) | ||
439 | client->prt_isdb_stats_ex(client->debug_data, p); | ||
440 | |||
441 | /* Update ISDB-T transmission parameters */ | ||
442 | c->frequency = p->frequency; | ||
443 | client->fe_status = sms_to_status(p->is_demod_locked, 0); | ||
444 | c->bandwidth_hz = sms_to_bw(p->bandwidth); | ||
445 | c->transmission_mode = sms_to_mode(p->transmission_mode); | ||
446 | c->guard_interval = sms_to_guard_interval(p->guard_interval); | ||
447 | c->isdbt_partial_reception = p->partial_reception ? 1 : 0; | ||
448 | n_layers = p->num_of_layers; | ||
449 | if (n_layers < 1) | ||
450 | n_layers = 1; | ||
451 | if (n_layers > 3) | ||
452 | n_layers = 3; | ||
453 | c->isdbt_layer_enabled = 0; | ||
454 | |||
455 | /* update reception data */ | ||
456 | c->lna = p->is_external_lna_on ? 1 : 0; | ||
457 | |||
458 | /* Carrier to noise ratio, in DB */ | ||
459 | c->cnr.stat[0].svalue = p->SNR * 1000; | ||
460 | |||
461 | /* signal Strength, in DBm */ | ||
462 | c->strength.stat[0].uvalue = p->in_band_pwr * 1000; | ||
463 | |||
464 | /* PER/BER and per-layer stats require demod lock */ | ||
465 | if (!p->is_demod_locked) | ||
466 | return; | ||
467 | |||
468 | client->last_per = c->block_error.stat[0].uvalue; | ||
469 | |||
470 | /* Clears global counters, as the code below will sum it again */ | ||
471 | c->block_error.stat[0].uvalue = 0; | ||
472 | c->block_count.stat[0].uvalue = 0; | ||
473 | c->block_error.stat[0].scale = FE_SCALE_COUNTER; | ||
474 | c->block_count.stat[0].scale = FE_SCALE_COUNTER; | ||
475 | c->post_bit_error.stat[0].uvalue = 0; | ||
476 | c->post_bit_count.stat[0].uvalue = 0; | ||
477 | c->post_bit_error.stat[0].scale = FE_SCALE_COUNTER; | ||
478 | c->post_bit_count.stat[0].scale = FE_SCALE_COUNTER; | ||
479 | |||
480 | c->post_bit_error.len = n_layers + 1; | ||
481 | c->post_bit_count.len = n_layers + 1; | ||
482 | c->block_error.len = n_layers + 1; | ||
483 | c->block_count.len = n_layers + 1; | ||
484 | for (i = 0; i < n_layers; i++) { | ||
485 | lr = &p->layer_info[i]; | ||
486 | |||
487 | /* Update per-layer transmission parameters */ | ||
488 | if (lr->number_of_segments > 0 && lr->number_of_segments < 13) { | ||
489 | c->isdbt_layer_enabled |= 1 << i; | ||
490 | c->layer[i].segment_count = lr->number_of_segments; | ||
491 | } else { | ||
492 | continue; | ||
493 | } | ||
494 | c->layer[i].modulation = sms_to_modulation(lr->constellation); | ||
495 | |||
496 | /* TS PER */ | ||
497 | c->block_error.stat[i + 1].scale = FE_SCALE_COUNTER; | ||
498 | c->block_count.stat[i + 1].scale = FE_SCALE_COUNTER; | ||
499 | c->block_error.stat[i + 1].uvalue += lr->error_ts_packets; | ||
500 | c->block_count.stat[i + 1].uvalue += lr->total_ts_packets; | ||
501 | |||
502 | /* Update global PER counter */ | ||
503 | c->block_error.stat[0].uvalue += lr->error_ts_packets; | ||
504 | c->block_count.stat[0].uvalue += lr->total_ts_packets; | ||
505 | |||
506 | /* ber */ | ||
507 | c->post_bit_error.stat[i + 1].scale = FE_SCALE_COUNTER; | ||
508 | c->post_bit_count.stat[i + 1].scale = FE_SCALE_COUNTER; | ||
509 | c->post_bit_error.stat[i + 1].uvalue += lr->ber_error_count; | ||
510 | c->post_bit_count.stat[i + 1].uvalue += lr->ber_bit_count; | ||
511 | |||
512 | /* Update global ber counter */ | ||
513 | c->post_bit_error.stat[0].uvalue += lr->ber_error_count; | ||
514 | c->post_bit_count.stat[0].uvalue += lr->ber_bit_count; | ||
515 | } | ||
516 | } | ||
517 | |||
518 | static int smsdvb_onresponse(void *context, struct smscore_buffer_t *cb) | ||
519 | { | ||
520 | struct smsdvb_client_t *client = (struct smsdvb_client_t *) context; | ||
521 | struct sms_msg_hdr *phdr = (struct sms_msg_hdr *) (((u8 *) cb->p) | ||
522 | + cb->offset); | ||
523 | void *p = phdr + 1; | ||
524 | struct dvb_frontend *fe = &client->frontend; | ||
525 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; | ||
526 | bool is_status_update = false; | ||
527 | |||
528 | switch (phdr->msg_type) { | ||
529 | case MSG_SMS_DVBT_BDA_DATA: | ||
530 | /* | ||
531 | * Only feed data to dvb demux if are there any feed listening | ||
532 | * to it and if the device has tuned | ||
533 | */ | ||
534 | if (client->feed_users && client->has_tuned) | ||
535 | dvb_dmx_swfilter(&client->demux, p, | ||
536 | cb->size - sizeof(struct sms_msg_hdr)); | ||
537 | break; | ||
538 | |||
539 | case MSG_SMS_RF_TUNE_RES: | ||
540 | case MSG_SMS_ISDBT_TUNE_RES: | ||
541 | complete(&client->tune_done); | ||
542 | break; | ||
543 | |||
544 | case MSG_SMS_SIGNAL_DETECTED_IND: | ||
545 | client->fe_status = FE_HAS_SIGNAL | FE_HAS_CARRIER | | ||
546 | FE_HAS_VITERBI | FE_HAS_SYNC | | ||
547 | FE_HAS_LOCK; | ||
548 | |||
549 | is_status_update = true; | ||
550 | break; | ||
551 | |||
552 | case MSG_SMS_NO_SIGNAL_IND: | ||
553 | client->fe_status = 0; | ||
554 | |||
555 | is_status_update = true; | ||
556 | break; | ||
557 | |||
558 | case MSG_SMS_TRANSMISSION_IND: | ||
559 | smsdvb_update_tx_params(client, p); | ||
560 | |||
561 | is_status_update = true; | ||
562 | break; | ||
563 | |||
564 | case MSG_SMS_HO_PER_SLICES_IND: | ||
565 | smsdvb_update_per_slices(client, p); | ||
566 | |||
567 | is_status_update = true; | ||
568 | break; | ||
569 | |||
570 | case MSG_SMS_GET_STATISTICS_RES: | ||
571 | switch (smscore_get_device_mode(client->coredev)) { | ||
572 | case DEVICE_MODE_ISDBT: | ||
573 | case DEVICE_MODE_ISDBT_BDA: | ||
574 | smsdvb_update_isdbt_stats(client, p); | ||
575 | break; | ||
576 | default: | ||
577 | /* Skip sms_msg_statistics_info:request_result field */ | ||
578 | smsdvb_update_dvb_stats(client, p + sizeof(u32)); | ||
579 | } | ||
580 | |||
581 | is_status_update = true; | ||
582 | break; | ||
583 | |||
584 | /* Only for ISDB-T */ | ||
585 | case MSG_SMS_GET_STATISTICS_EX_RES: | ||
586 | /* Skip sms_msg_statistics_info:request_result field? */ | ||
587 | smsdvb_update_isdbt_stats_ex(client, p + sizeof(u32)); | ||
588 | is_status_update = true; | ||
589 | break; | ||
590 | default: | ||
591 | sms_info("message not handled"); | ||
592 | } | ||
593 | smscore_putbuffer(client->coredev, cb); | ||
594 | |||
595 | if (is_status_update) { | ||
596 | if (client->fe_status & FE_HAS_LOCK) { | ||
597 | sms_board_dvb3_event(client, DVB3_EVENT_FE_LOCK); | ||
598 | if (client->last_per == c->block_error.stat[0].uvalue) | ||
599 | sms_board_dvb3_event(client, DVB3_EVENT_UNC_OK); | ||
600 | else | ||
601 | sms_board_dvb3_event(client, DVB3_EVENT_UNC_ERR); | ||
602 | client->has_tuned = true; | ||
603 | } else { | ||
604 | smsdvb_stats_not_ready(fe); | ||
605 | client->has_tuned = false; | ||
606 | sms_board_dvb3_event(client, DVB3_EVENT_FE_UNLOCK); | ||
607 | } | ||
608 | complete(&client->stats_done); | ||
609 | } | ||
610 | |||
611 | return 0; | ||
612 | } | ||
613 | |||
614 | static void smsdvb_unregister_client(struct smsdvb_client_t *client) | ||
615 | { | ||
616 | /* must be called under clientslock */ | ||
617 | |||
618 | list_del(&client->entry); | ||
619 | |||
620 | smsdvb_debugfs_release(client); | ||
621 | smscore_unregister_client(client->smsclient); | ||
622 | dvb_unregister_frontend(&client->frontend); | ||
623 | dvb_dmxdev_release(&client->dmxdev); | ||
624 | dvb_dmx_release(&client->demux); | ||
625 | dvb_unregister_adapter(&client->adapter); | ||
626 | kfree(client); | ||
627 | } | ||
628 | |||
629 | static void smsdvb_onremove(void *context) | ||
630 | { | ||
631 | kmutex_lock(&g_smsdvb_clientslock); | ||
632 | |||
633 | smsdvb_unregister_client((struct smsdvb_client_t *) context); | ||
634 | |||
635 | kmutex_unlock(&g_smsdvb_clientslock); | ||
636 | } | ||
637 | |||
638 | static int smsdvb_start_feed(struct dvb_demux_feed *feed) | ||
639 | { | ||
640 | struct smsdvb_client_t *client = | ||
641 | container_of(feed->demux, struct smsdvb_client_t, demux); | ||
642 | struct sms_msg_data pid_msg; | ||
643 | |||
644 | sms_debug("add pid %d(%x)", | ||
645 | feed->pid, feed->pid); | ||
646 | |||
647 | client->feed_users++; | ||
648 | |||
649 | pid_msg.x_msg_header.msg_src_id = DVBT_BDA_CONTROL_MSG_ID; | ||
650 | pid_msg.x_msg_header.msg_dst_id = HIF_TASK; | ||
651 | pid_msg.x_msg_header.msg_flags = 0; | ||
652 | pid_msg.x_msg_header.msg_type = MSG_SMS_ADD_PID_FILTER_REQ; | ||
653 | pid_msg.x_msg_header.msg_length = sizeof(pid_msg); | ||
654 | pid_msg.msg_data[0] = feed->pid; | ||
655 | |||
656 | return smsclient_sendrequest(client->smsclient, | ||
657 | &pid_msg, sizeof(pid_msg)); | ||
658 | } | ||
659 | |||
660 | static int smsdvb_stop_feed(struct dvb_demux_feed *feed) | ||
661 | { | ||
662 | struct smsdvb_client_t *client = | ||
663 | container_of(feed->demux, struct smsdvb_client_t, demux); | ||
664 | struct sms_msg_data pid_msg; | ||
665 | |||
666 | sms_debug("remove pid %d(%x)", | ||
667 | feed->pid, feed->pid); | ||
668 | |||
669 | client->feed_users--; | ||
670 | |||
671 | pid_msg.x_msg_header.msg_src_id = DVBT_BDA_CONTROL_MSG_ID; | ||
672 | pid_msg.x_msg_header.msg_dst_id = HIF_TASK; | ||
673 | pid_msg.x_msg_header.msg_flags = 0; | ||
674 | pid_msg.x_msg_header.msg_type = MSG_SMS_REMOVE_PID_FILTER_REQ; | ||
675 | pid_msg.x_msg_header.msg_length = sizeof(pid_msg); | ||
676 | pid_msg.msg_data[0] = feed->pid; | ||
677 | |||
678 | return smsclient_sendrequest(client->smsclient, | ||
679 | &pid_msg, sizeof(pid_msg)); | ||
680 | } | ||
681 | |||
682 | static int smsdvb_sendrequest_and_wait(struct smsdvb_client_t *client, | ||
683 | void *buffer, size_t size, | ||
684 | struct completion *completion) | ||
685 | { | ||
686 | int rc; | ||
687 | |||
688 | rc = smsclient_sendrequest(client->smsclient, buffer, size); | ||
689 | if (rc < 0) | ||
690 | return rc; | ||
691 | |||
692 | return wait_for_completion_timeout(completion, | ||
693 | msecs_to_jiffies(2000)) ? | ||
694 | 0 : -ETIME; | ||
695 | } | ||
696 | |||
697 | static int smsdvb_send_statistics_request(struct smsdvb_client_t *client) | ||
698 | { | ||
699 | int rc; | ||
700 | struct sms_msg_hdr msg; | ||
701 | |||
702 | /* Don't request stats too fast */ | ||
703 | if (client->get_stats_jiffies && | ||
704 | (!time_after(jiffies, client->get_stats_jiffies))) | ||
705 | return 0; | ||
706 | client->get_stats_jiffies = jiffies + msecs_to_jiffies(100); | ||
707 | |||
708 | msg.msg_src_id = DVBT_BDA_CONTROL_MSG_ID; | ||
709 | msg.msg_dst_id = HIF_TASK; | ||
710 | msg.msg_flags = 0; | ||
711 | msg.msg_length = sizeof(msg); | ||
712 | |||
713 | switch (smscore_get_device_mode(client->coredev)) { | ||
714 | case DEVICE_MODE_ISDBT: | ||
715 | case DEVICE_MODE_ISDBT_BDA: | ||
716 | /* | ||
717 | * Check for firmware version, to avoid breaking for old cards | ||
718 | */ | ||
719 | if (client->coredev->fw_version >= 0x800) | ||
720 | msg.msg_type = MSG_SMS_GET_STATISTICS_EX_REQ; | ||
721 | else | ||
722 | msg.msg_type = MSG_SMS_GET_STATISTICS_REQ; | ||
723 | break; | ||
724 | default: | ||
725 | msg.msg_type = MSG_SMS_GET_STATISTICS_REQ; | ||
726 | } | ||
727 | |||
728 | rc = smsdvb_sendrequest_and_wait(client, &msg, sizeof(msg), | ||
729 | &client->stats_done); | ||
730 | |||
731 | return rc; | ||
732 | } | ||
733 | |||
734 | static inline int led_feedback(struct smsdvb_client_t *client) | ||
735 | { | ||
736 | if (!(client->fe_status & FE_HAS_LOCK)) | ||
737 | return sms_board_led_feedback(client->coredev, SMS_LED_OFF); | ||
738 | |||
739 | return sms_board_led_feedback(client->coredev, | ||
740 | (client->legacy_ber == 0) ? | ||
741 | SMS_LED_HI : SMS_LED_LO); | ||
742 | } | ||
743 | |||
744 | static int smsdvb_read_status(struct dvb_frontend *fe, fe_status_t *stat) | ||
745 | { | ||
746 | int rc; | ||
747 | struct smsdvb_client_t *client; | ||
748 | client = container_of(fe, struct smsdvb_client_t, frontend); | ||
749 | |||
750 | rc = smsdvb_send_statistics_request(client); | ||
751 | |||
752 | *stat = client->fe_status; | ||
753 | |||
754 | led_feedback(client); | ||
755 | |||
756 | return rc; | ||
757 | } | ||
758 | |||
759 | static int smsdvb_read_ber(struct dvb_frontend *fe, u32 *ber) | ||
760 | { | ||
761 | int rc; | ||
762 | struct smsdvb_client_t *client; | ||
763 | |||
764 | client = container_of(fe, struct smsdvb_client_t, frontend); | ||
765 | |||
766 | rc = smsdvb_send_statistics_request(client); | ||
767 | |||
768 | *ber = client->legacy_ber; | ||
769 | |||
770 | led_feedback(client); | ||
771 | |||
772 | return rc; | ||
773 | } | ||
774 | |||
775 | static int smsdvb_read_signal_strength(struct dvb_frontend *fe, u16 *strength) | ||
776 | { | ||
777 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; | ||
778 | int rc; | ||
779 | s32 power = (s32) c->strength.stat[0].uvalue; | ||
780 | struct smsdvb_client_t *client; | ||
781 | |||
782 | client = container_of(fe, struct smsdvb_client_t, frontend); | ||
783 | |||
784 | rc = smsdvb_send_statistics_request(client); | ||
785 | |||
786 | if (power < -95) | ||
787 | *strength = 0; | ||
788 | else if (power > -29) | ||
789 | *strength = 65535; | ||
790 | else | ||
791 | *strength = (power + 95) * 65535 / 66; | ||
792 | |||
793 | led_feedback(client); | ||
794 | |||
795 | return rc; | ||
796 | } | ||
797 | |||
798 | static int smsdvb_read_snr(struct dvb_frontend *fe, u16 *snr) | ||
799 | { | ||
800 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; | ||
801 | int rc; | ||
802 | struct smsdvb_client_t *client; | ||
803 | |||
804 | client = container_of(fe, struct smsdvb_client_t, frontend); | ||
805 | |||
806 | rc = smsdvb_send_statistics_request(client); | ||
807 | |||
808 | /* Preferred scale for SNR with legacy API: 0.1 dB */ | ||
809 | *snr = ((u32)c->cnr.stat[0].svalue) / 100; | ||
810 | |||
811 | led_feedback(client); | ||
812 | |||
813 | return rc; | ||
814 | } | ||
815 | |||
816 | static int smsdvb_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks) | ||
817 | { | ||
818 | int rc; | ||
819 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; | ||
820 | struct smsdvb_client_t *client; | ||
821 | |||
822 | client = container_of(fe, struct smsdvb_client_t, frontend); | ||
823 | |||
824 | rc = smsdvb_send_statistics_request(client); | ||
825 | |||
826 | *ucblocks = c->block_error.stat[0].uvalue; | ||
827 | |||
828 | led_feedback(client); | ||
829 | |||
830 | return rc; | ||
831 | } | ||
832 | |||
833 | static int smsdvb_get_tune_settings(struct dvb_frontend *fe, | ||
834 | struct dvb_frontend_tune_settings *tune) | ||
835 | { | ||
836 | sms_debug(""); | ||
837 | |||
838 | tune->min_delay_ms = 400; | ||
839 | tune->step_size = 250000; | ||
840 | tune->max_drift = 0; | ||
841 | return 0; | ||
842 | } | ||
843 | |||
844 | static int smsdvb_dvbt_set_frontend(struct dvb_frontend *fe) | ||
845 | { | ||
846 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; | ||
847 | struct smsdvb_client_t *client = | ||
848 | container_of(fe, struct smsdvb_client_t, frontend); | ||
849 | |||
850 | struct { | ||
851 | struct sms_msg_hdr msg; | ||
852 | u32 Data[3]; | ||
853 | } msg; | ||
854 | |||
855 | int ret; | ||
856 | |||
857 | client->fe_status = 0; | ||
858 | client->event_fe_state = -1; | ||
859 | client->event_unc_state = -1; | ||
860 | fe->dtv_property_cache.delivery_system = SYS_DVBT; | ||
861 | |||
862 | msg.msg.msg_src_id = DVBT_BDA_CONTROL_MSG_ID; | ||
863 | msg.msg.msg_dst_id = HIF_TASK; | ||
864 | msg.msg.msg_flags = 0; | ||
865 | msg.msg.msg_type = MSG_SMS_RF_TUNE_REQ; | ||
866 | msg.msg.msg_length = sizeof(msg); | ||
867 | msg.Data[0] = c->frequency; | ||
868 | msg.Data[2] = 12000000; | ||
869 | |||
870 | sms_info("%s: freq %d band %d", __func__, c->frequency, | ||
871 | c->bandwidth_hz); | ||
872 | |||
873 | switch (c->bandwidth_hz / 1000000) { | ||
874 | case 8: | ||
875 | msg.Data[1] = BW_8_MHZ; | ||
876 | break; | ||
877 | case 7: | ||
878 | msg.Data[1] = BW_7_MHZ; | ||
879 | break; | ||
880 | case 6: | ||
881 | msg.Data[1] = BW_6_MHZ; | ||
882 | break; | ||
883 | case 0: | ||
884 | return -EOPNOTSUPP; | ||
885 | default: | ||
886 | return -EINVAL; | ||
887 | } | ||
888 | /* Disable LNA, if any. An error is returned if no LNA is present */ | ||
889 | ret = sms_board_lna_control(client->coredev, 0); | ||
890 | if (ret == 0) { | ||
891 | fe_status_t status; | ||
892 | |||
893 | /* tune with LNA off at first */ | ||
894 | ret = smsdvb_sendrequest_and_wait(client, &msg, sizeof(msg), | ||
895 | &client->tune_done); | ||
896 | |||
897 | smsdvb_read_status(fe, &status); | ||
898 | |||
899 | if (status & FE_HAS_LOCK) | ||
900 | return ret; | ||
901 | |||
902 | /* previous tune didn't lock - enable LNA and tune again */ | ||
903 | sms_board_lna_control(client->coredev, 1); | ||
904 | } | ||
905 | |||
906 | return smsdvb_sendrequest_and_wait(client, &msg, sizeof(msg), | ||
907 | &client->tune_done); | ||
908 | } | ||
909 | |||
910 | static int smsdvb_isdbt_set_frontend(struct dvb_frontend *fe) | ||
911 | { | ||
912 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; | ||
913 | struct smsdvb_client_t *client = | ||
914 | container_of(fe, struct smsdvb_client_t, frontend); | ||
915 | int board_id = smscore_get_board_id(client->coredev); | ||
916 | struct sms_board *board = sms_get_board(board_id); | ||
917 | enum sms_device_type_st type = board->type; | ||
918 | int ret; | ||
919 | |||
920 | struct { | ||
921 | struct sms_msg_hdr msg; | ||
922 | u32 Data[4]; | ||
923 | } msg; | ||
924 | |||
925 | fe->dtv_property_cache.delivery_system = SYS_ISDBT; | ||
926 | |||
927 | msg.msg.msg_src_id = DVBT_BDA_CONTROL_MSG_ID; | ||
928 | msg.msg.msg_dst_id = HIF_TASK; | ||
929 | msg.msg.msg_flags = 0; | ||
930 | msg.msg.msg_type = MSG_SMS_ISDBT_TUNE_REQ; | ||
931 | msg.msg.msg_length = sizeof(msg); | ||
932 | |||
933 | if (c->isdbt_sb_segment_idx == -1) | ||
934 | c->isdbt_sb_segment_idx = 0; | ||
935 | |||
936 | if (!c->isdbt_layer_enabled) | ||
937 | c->isdbt_layer_enabled = 7; | ||
938 | |||
939 | msg.Data[0] = c->frequency; | ||
940 | msg.Data[1] = BW_ISDBT_1SEG; | ||
941 | msg.Data[2] = 12000000; | ||
942 | msg.Data[3] = c->isdbt_sb_segment_idx; | ||
943 | |||
944 | if (c->isdbt_partial_reception) { | ||
945 | if ((type == SMS_PELE || type == SMS_RIO) && | ||
946 | c->isdbt_sb_segment_count > 3) | ||
947 | msg.Data[1] = BW_ISDBT_13SEG; | ||
948 | else if (c->isdbt_sb_segment_count > 1) | ||
949 | msg.Data[1] = BW_ISDBT_3SEG; | ||
950 | } else if (type == SMS_PELE || type == SMS_RIO) | ||
951 | msg.Data[1] = BW_ISDBT_13SEG; | ||
952 | |||
953 | c->bandwidth_hz = 6000000; | ||
954 | |||
955 | sms_info("%s: freq %d segwidth %d segindex %d", __func__, | ||
956 | c->frequency, c->isdbt_sb_segment_count, | ||
957 | c->isdbt_sb_segment_idx); | ||
958 | |||
959 | /* Disable LNA, if any. An error is returned if no LNA is present */ | ||
960 | ret = sms_board_lna_control(client->coredev, 0); | ||
961 | if (ret == 0) { | ||
962 | fe_status_t status; | ||
963 | |||
964 | /* tune with LNA off at first */ | ||
965 | ret = smsdvb_sendrequest_and_wait(client, &msg, sizeof(msg), | ||
966 | &client->tune_done); | ||
967 | |||
968 | smsdvb_read_status(fe, &status); | ||
969 | |||
970 | if (status & FE_HAS_LOCK) | ||
971 | return ret; | ||
972 | |||
973 | /* previous tune didn't lock - enable LNA and tune again */ | ||
974 | sms_board_lna_control(client->coredev, 1); | ||
975 | } | ||
976 | return smsdvb_sendrequest_and_wait(client, &msg, sizeof(msg), | ||
977 | &client->tune_done); | ||
978 | } | ||
979 | |||
980 | static int smsdvb_set_frontend(struct dvb_frontend *fe) | ||
981 | { | ||
982 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; | ||
983 | struct smsdvb_client_t *client = | ||
984 | container_of(fe, struct smsdvb_client_t, frontend); | ||
985 | struct smscore_device_t *coredev = client->coredev; | ||
986 | |||
987 | smsdvb_stats_not_ready(fe); | ||
988 | c->strength.stat[0].uvalue = 0; | ||
989 | c->cnr.stat[0].uvalue = 0; | ||
990 | |||
991 | client->has_tuned = false; | ||
992 | |||
993 | switch (smscore_get_device_mode(coredev)) { | ||
994 | case DEVICE_MODE_DVBT: | ||
995 | case DEVICE_MODE_DVBT_BDA: | ||
996 | return smsdvb_dvbt_set_frontend(fe); | ||
997 | case DEVICE_MODE_ISDBT: | ||
998 | case DEVICE_MODE_ISDBT_BDA: | ||
999 | return smsdvb_isdbt_set_frontend(fe); | ||
1000 | default: | ||
1001 | return -EINVAL; | ||
1002 | } | ||
1003 | } | ||
1004 | |||
1005 | /* Nothing to do here, as stats are automatically updated */ | ||
1006 | static int smsdvb_get_frontend(struct dvb_frontend *fe) | ||
1007 | { | ||
1008 | return 0; | ||
1009 | } | ||
1010 | |||
1011 | static int smsdvb_init(struct dvb_frontend *fe) | ||
1012 | { | ||
1013 | struct smsdvb_client_t *client = | ||
1014 | container_of(fe, struct smsdvb_client_t, frontend); | ||
1015 | |||
1016 | sms_board_power(client->coredev, 1); | ||
1017 | |||
1018 | sms_board_dvb3_event(client, DVB3_EVENT_INIT); | ||
1019 | return 0; | ||
1020 | } | ||
1021 | |||
1022 | static int smsdvb_sleep(struct dvb_frontend *fe) | ||
1023 | { | ||
1024 | struct smsdvb_client_t *client = | ||
1025 | container_of(fe, struct smsdvb_client_t, frontend); | ||
1026 | |||
1027 | sms_board_led_feedback(client->coredev, SMS_LED_OFF); | ||
1028 | sms_board_power(client->coredev, 0); | ||
1029 | |||
1030 | sms_board_dvb3_event(client, DVB3_EVENT_SLEEP); | ||
1031 | |||
1032 | return 0; | ||
1033 | } | ||
1034 | |||
1035 | static void smsdvb_release(struct dvb_frontend *fe) | ||
1036 | { | ||
1037 | /* do nothing */ | ||
1038 | } | ||
1039 | |||
1040 | static struct dvb_frontend_ops smsdvb_fe_ops = { | ||
1041 | .info = { | ||
1042 | .name = "Siano Mobile Digital MDTV Receiver", | ||
1043 | .frequency_min = 44250000, | ||
1044 | .frequency_max = 867250000, | ||
1045 | .frequency_stepsize = 250000, | ||
1046 | .caps = FE_CAN_INVERSION_AUTO | | ||
1047 | FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 | | ||
1048 | FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO | | ||
1049 | FE_CAN_QPSK | FE_CAN_QAM_16 | FE_CAN_QAM_64 | | ||
1050 | FE_CAN_QAM_AUTO | FE_CAN_TRANSMISSION_MODE_AUTO | | ||
1051 | FE_CAN_GUARD_INTERVAL_AUTO | | ||
1052 | FE_CAN_RECOVER | | ||
1053 | FE_CAN_HIERARCHY_AUTO, | ||
1054 | }, | ||
1055 | |||
1056 | .release = smsdvb_release, | ||
1057 | |||
1058 | .set_frontend = smsdvb_set_frontend, | ||
1059 | .get_frontend = smsdvb_get_frontend, | ||
1060 | .get_tune_settings = smsdvb_get_tune_settings, | ||
1061 | |||
1062 | .read_status = smsdvb_read_status, | ||
1063 | .read_ber = smsdvb_read_ber, | ||
1064 | .read_signal_strength = smsdvb_read_signal_strength, | ||
1065 | .read_snr = smsdvb_read_snr, | ||
1066 | .read_ucblocks = smsdvb_read_ucblocks, | ||
1067 | |||
1068 | .init = smsdvb_init, | ||
1069 | .sleep = smsdvb_sleep, | ||
1070 | }; | ||
1071 | |||
1072 | static int smsdvb_hotplug(struct smscore_device_t *coredev, | ||
1073 | struct device *device, int arrival) | ||
1074 | { | ||
1075 | struct smsclient_params_t params; | ||
1076 | struct smsdvb_client_t *client; | ||
1077 | int rc; | ||
1078 | |||
1079 | /* device removal handled by onremove callback */ | ||
1080 | if (!arrival) | ||
1081 | return 0; | ||
1082 | client = kzalloc(sizeof(struct smsdvb_client_t), GFP_KERNEL); | ||
1083 | if (!client) { | ||
1084 | sms_err("kmalloc() failed"); | ||
1085 | return -ENOMEM; | ||
1086 | } | ||
1087 | |||
1088 | /* register dvb adapter */ | ||
1089 | rc = dvb_register_adapter(&client->adapter, | ||
1090 | sms_get_board( | ||
1091 | smscore_get_board_id(coredev))->name, | ||
1092 | THIS_MODULE, device, adapter_nr); | ||
1093 | if (rc < 0) { | ||
1094 | sms_err("dvb_register_adapter() failed %d", rc); | ||
1095 | goto adapter_error; | ||
1096 | } | ||
1097 | |||
1098 | /* init dvb demux */ | ||
1099 | client->demux.dmx.capabilities = DMX_TS_FILTERING; | ||
1100 | client->demux.filternum = 32; /* todo: nova ??? */ | ||
1101 | client->demux.feednum = 32; | ||
1102 | client->demux.start_feed = smsdvb_start_feed; | ||
1103 | client->demux.stop_feed = smsdvb_stop_feed; | ||
1104 | |||
1105 | rc = dvb_dmx_init(&client->demux); | ||
1106 | if (rc < 0) { | ||
1107 | sms_err("dvb_dmx_init failed %d", rc); | ||
1108 | goto dvbdmx_error; | ||
1109 | } | ||
1110 | |||
1111 | /* init dmxdev */ | ||
1112 | client->dmxdev.filternum = 32; | ||
1113 | client->dmxdev.demux = &client->demux.dmx; | ||
1114 | client->dmxdev.capabilities = 0; | ||
1115 | |||
1116 | rc = dvb_dmxdev_init(&client->dmxdev, &client->adapter); | ||
1117 | if (rc < 0) { | ||
1118 | sms_err("dvb_dmxdev_init failed %d", rc); | ||
1119 | goto dmxdev_error; | ||
1120 | } | ||
1121 | |||
1122 | /* init and register frontend */ | ||
1123 | memcpy(&client->frontend.ops, &smsdvb_fe_ops, | ||
1124 | sizeof(struct dvb_frontend_ops)); | ||
1125 | |||
1126 | switch (smscore_get_device_mode(coredev)) { | ||
1127 | case DEVICE_MODE_DVBT: | ||
1128 | case DEVICE_MODE_DVBT_BDA: | ||
1129 | client->frontend.ops.delsys[0] = SYS_DVBT; | ||
1130 | break; | ||
1131 | case DEVICE_MODE_ISDBT: | ||
1132 | case DEVICE_MODE_ISDBT_BDA: | ||
1133 | client->frontend.ops.delsys[0] = SYS_ISDBT; | ||
1134 | break; | ||
1135 | } | ||
1136 | |||
1137 | rc = dvb_register_frontend(&client->adapter, &client->frontend); | ||
1138 | if (rc < 0) { | ||
1139 | sms_err("frontend registration failed %d", rc); | ||
1140 | goto frontend_error; | ||
1141 | } | ||
1142 | |||
1143 | params.initial_id = 1; | ||
1144 | params.data_type = MSG_SMS_DVBT_BDA_DATA; | ||
1145 | params.onresponse_handler = smsdvb_onresponse; | ||
1146 | params.onremove_handler = smsdvb_onremove; | ||
1147 | params.context = client; | ||
1148 | |||
1149 | rc = smscore_register_client(coredev, ¶ms, &client->smsclient); | ||
1150 | if (rc < 0) { | ||
1151 | sms_err("smscore_register_client() failed %d", rc); | ||
1152 | goto client_error; | ||
1153 | } | ||
1154 | |||
1155 | client->coredev = coredev; | ||
1156 | |||
1157 | init_completion(&client->tune_done); | ||
1158 | init_completion(&client->stats_done); | ||
1159 | |||
1160 | kmutex_lock(&g_smsdvb_clientslock); | ||
1161 | |||
1162 | list_add(&client->entry, &g_smsdvb_clients); | ||
1163 | |||
1164 | kmutex_unlock(&g_smsdvb_clientslock); | ||
1165 | |||
1166 | client->event_fe_state = -1; | ||
1167 | client->event_unc_state = -1; | ||
1168 | sms_board_dvb3_event(client, DVB3_EVENT_HOTPLUG); | ||
1169 | |||
1170 | sms_info("success"); | ||
1171 | sms_board_setup(coredev); | ||
1172 | |||
1173 | if (smsdvb_debugfs_create(client) < 0) | ||
1174 | sms_info("failed to create debugfs node"); | ||
1175 | |||
1176 | return 0; | ||
1177 | |||
1178 | client_error: | ||
1179 | dvb_unregister_frontend(&client->frontend); | ||
1180 | |||
1181 | frontend_error: | ||
1182 | dvb_dmxdev_release(&client->dmxdev); | ||
1183 | |||
1184 | dmxdev_error: | ||
1185 | dvb_dmx_release(&client->demux); | ||
1186 | |||
1187 | dvbdmx_error: | ||
1188 | dvb_unregister_adapter(&client->adapter); | ||
1189 | |||
1190 | adapter_error: | ||
1191 | kfree(client); | ||
1192 | return rc; | ||
1193 | } | ||
1194 | |||
1195 | static int __init smsdvb_module_init(void) | ||
1196 | { | ||
1197 | int rc; | ||
1198 | |||
1199 | INIT_LIST_HEAD(&g_smsdvb_clients); | ||
1200 | kmutex_init(&g_smsdvb_clientslock); | ||
1201 | |||
1202 | smsdvb_debugfs_register(); | ||
1203 | |||
1204 | rc = smscore_register_hotplug(smsdvb_hotplug); | ||
1205 | |||
1206 | sms_debug(""); | ||
1207 | |||
1208 | return rc; | ||
1209 | } | ||
1210 | |||
1211 | static void __exit smsdvb_module_exit(void) | ||
1212 | { | ||
1213 | smscore_unregister_hotplug(smsdvb_hotplug); | ||
1214 | |||
1215 | kmutex_lock(&g_smsdvb_clientslock); | ||
1216 | |||
1217 | while (!list_empty(&g_smsdvb_clients)) | ||
1218 | smsdvb_unregister_client((struct smsdvb_client_t *)g_smsdvb_clients.next); | ||
1219 | |||
1220 | smsdvb_debugfs_unregister(); | ||
1221 | |||
1222 | kmutex_unlock(&g_smsdvb_clientslock); | ||
1223 | } | ||
1224 | |||
1225 | module_init(smsdvb_module_init); | ||
1226 | module_exit(smsdvb_module_exit); | ||
1227 | |||
1228 | MODULE_DESCRIPTION("SMS DVB subsystem adaptation module"); | ||
1229 | MODULE_AUTHOR("Siano Mobile Silicon, Inc. (uris@siano-ms.com)"); | ||
1230 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/media/common/siano/smsdvb.c b/drivers/media/common/siano/smsdvb.c deleted file mode 100644 index aa77e54a8fae..000000000000 --- a/drivers/media/common/siano/smsdvb.c +++ /dev/null | |||
@@ -1,1078 +0,0 @@ | |||
1 | /**************************************************************** | ||
2 | |||
3 | Siano Mobile Silicon, Inc. | ||
4 | MDTV receiver kernel modules. | ||
5 | Copyright (C) 2006-2008, Uri Shkolnik | ||
6 | |||
7 | This program is free software: you can redistribute it and/or modify | ||
8 | it under the terms of the GNU General Public License as published by | ||
9 | the Free Software Foundation, either version 2 of the License, or | ||
10 | (at your option) any later version. | ||
11 | |||
12 | This program is distributed in the hope that it will be useful, | ||
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | GNU General Public License for more details. | ||
16 | |||
17 | You should have received a copy of the GNU General Public License | ||
18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
19 | |||
20 | ****************************************************************/ | ||
21 | |||
22 | #include <linux/module.h> | ||
23 | #include <linux/slab.h> | ||
24 | #include <linux/init.h> | ||
25 | |||
26 | #include "dmxdev.h" | ||
27 | #include "dvbdev.h" | ||
28 | #include "dvb_demux.h" | ||
29 | #include "dvb_frontend.h" | ||
30 | |||
31 | #include "smscoreapi.h" | ||
32 | #include "smsendian.h" | ||
33 | #include "sms-cards.h" | ||
34 | |||
35 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); | ||
36 | |||
37 | struct smsdvb_client_t { | ||
38 | struct list_head entry; | ||
39 | |||
40 | struct smscore_device_t *coredev; | ||
41 | struct smscore_client_t *smsclient; | ||
42 | |||
43 | struct dvb_adapter adapter; | ||
44 | struct dvb_demux demux; | ||
45 | struct dmxdev dmxdev; | ||
46 | struct dvb_frontend frontend; | ||
47 | |||
48 | fe_status_t fe_status; | ||
49 | |||
50 | struct completion tune_done; | ||
51 | |||
52 | struct SMSHOSTLIB_STATISTICS_DVB_S sms_stat_dvb; | ||
53 | int event_fe_state; | ||
54 | int event_unc_state; | ||
55 | }; | ||
56 | |||
57 | static struct list_head g_smsdvb_clients; | ||
58 | static struct mutex g_smsdvb_clientslock; | ||
59 | |||
60 | static int sms_dbg; | ||
61 | module_param_named(debug, sms_dbg, int, 0644); | ||
62 | MODULE_PARM_DESC(debug, "set debug level (info=1, adv=2 (or-able))"); | ||
63 | |||
64 | /* Events that may come from DVB v3 adapter */ | ||
65 | static void sms_board_dvb3_event(struct smsdvb_client_t *client, | ||
66 | enum SMS_DVB3_EVENTS event) { | ||
67 | |||
68 | struct smscore_device_t *coredev = client->coredev; | ||
69 | switch (event) { | ||
70 | case DVB3_EVENT_INIT: | ||
71 | sms_debug("DVB3_EVENT_INIT"); | ||
72 | sms_board_event(coredev, BOARD_EVENT_BIND); | ||
73 | break; | ||
74 | case DVB3_EVENT_SLEEP: | ||
75 | sms_debug("DVB3_EVENT_SLEEP"); | ||
76 | sms_board_event(coredev, BOARD_EVENT_POWER_SUSPEND); | ||
77 | break; | ||
78 | case DVB3_EVENT_HOTPLUG: | ||
79 | sms_debug("DVB3_EVENT_HOTPLUG"); | ||
80 | sms_board_event(coredev, BOARD_EVENT_POWER_INIT); | ||
81 | break; | ||
82 | case DVB3_EVENT_FE_LOCK: | ||
83 | if (client->event_fe_state != DVB3_EVENT_FE_LOCK) { | ||
84 | client->event_fe_state = DVB3_EVENT_FE_LOCK; | ||
85 | sms_debug("DVB3_EVENT_FE_LOCK"); | ||
86 | sms_board_event(coredev, BOARD_EVENT_FE_LOCK); | ||
87 | } | ||
88 | break; | ||
89 | case DVB3_EVENT_FE_UNLOCK: | ||
90 | if (client->event_fe_state != DVB3_EVENT_FE_UNLOCK) { | ||
91 | client->event_fe_state = DVB3_EVENT_FE_UNLOCK; | ||
92 | sms_debug("DVB3_EVENT_FE_UNLOCK"); | ||
93 | sms_board_event(coredev, BOARD_EVENT_FE_UNLOCK); | ||
94 | } | ||
95 | break; | ||
96 | case DVB3_EVENT_UNC_OK: | ||
97 | if (client->event_unc_state != DVB3_EVENT_UNC_OK) { | ||
98 | client->event_unc_state = DVB3_EVENT_UNC_OK; | ||
99 | sms_debug("DVB3_EVENT_UNC_OK"); | ||
100 | sms_board_event(coredev, BOARD_EVENT_MULTIPLEX_OK); | ||
101 | } | ||
102 | break; | ||
103 | case DVB3_EVENT_UNC_ERR: | ||
104 | if (client->event_unc_state != DVB3_EVENT_UNC_ERR) { | ||
105 | client->event_unc_state = DVB3_EVENT_UNC_ERR; | ||
106 | sms_debug("DVB3_EVENT_UNC_ERR"); | ||
107 | sms_board_event(coredev, BOARD_EVENT_MULTIPLEX_ERRORS); | ||
108 | } | ||
109 | break; | ||
110 | |||
111 | default: | ||
112 | sms_err("Unknown dvb3 api event"); | ||
113 | break; | ||
114 | } | ||
115 | } | ||
116 | |||
117 | |||
118 | static void smsdvb_update_dvb_stats(struct RECEPTION_STATISTICS_S *pReceptionData, | ||
119 | struct SMSHOSTLIB_STATISTICS_ST *p) | ||
120 | { | ||
121 | if (sms_dbg & 2) { | ||
122 | printk(KERN_DEBUG "Reserved = %d", p->Reserved); | ||
123 | printk(KERN_DEBUG "IsRfLocked = %d", p->IsRfLocked); | ||
124 | printk(KERN_DEBUG "IsDemodLocked = %d", p->IsDemodLocked); | ||
125 | printk(KERN_DEBUG "IsExternalLNAOn = %d", p->IsExternalLNAOn); | ||
126 | printk(KERN_DEBUG "SNR = %d", p->SNR); | ||
127 | printk(KERN_DEBUG "BER = %d", p->BER); | ||
128 | printk(KERN_DEBUG "FIB_CRC = %d", p->FIB_CRC); | ||
129 | printk(KERN_DEBUG "TS_PER = %d", p->TS_PER); | ||
130 | printk(KERN_DEBUG "MFER = %d", p->MFER); | ||
131 | printk(KERN_DEBUG "RSSI = %d", p->RSSI); | ||
132 | printk(KERN_DEBUG "InBandPwr = %d", p->InBandPwr); | ||
133 | printk(KERN_DEBUG "CarrierOffset = %d", p->CarrierOffset); | ||
134 | printk(KERN_DEBUG "Frequency = %d", p->Frequency); | ||
135 | printk(KERN_DEBUG "Bandwidth = %d", p->Bandwidth); | ||
136 | printk(KERN_DEBUG "TransmissionMode = %d", p->TransmissionMode); | ||
137 | printk(KERN_DEBUG "ModemState = %d", p->ModemState); | ||
138 | printk(KERN_DEBUG "GuardInterval = %d", p->GuardInterval); | ||
139 | printk(KERN_DEBUG "CodeRate = %d", p->CodeRate); | ||
140 | printk(KERN_DEBUG "LPCodeRate = %d", p->LPCodeRate); | ||
141 | printk(KERN_DEBUG "Hierarchy = %d", p->Hierarchy); | ||
142 | printk(KERN_DEBUG "Constellation = %d", p->Constellation); | ||
143 | printk(KERN_DEBUG "BurstSize = %d", p->BurstSize); | ||
144 | printk(KERN_DEBUG "BurstDuration = %d", p->BurstDuration); | ||
145 | printk(KERN_DEBUG "BurstCycleTime = %d", p->BurstCycleTime); | ||
146 | printk(KERN_DEBUG "CalculatedBurstCycleTime = %d", p->CalculatedBurstCycleTime); | ||
147 | printk(KERN_DEBUG "NumOfRows = %d", p->NumOfRows); | ||
148 | printk(KERN_DEBUG "NumOfPaddCols = %d", p->NumOfPaddCols); | ||
149 | printk(KERN_DEBUG "NumOfPunctCols = %d", p->NumOfPunctCols); | ||
150 | printk(KERN_DEBUG "ErrorTSPackets = %d", p->ErrorTSPackets); | ||
151 | printk(KERN_DEBUG "TotalTSPackets = %d", p->TotalTSPackets); | ||
152 | printk(KERN_DEBUG "NumOfValidMpeTlbs = %d", p->NumOfValidMpeTlbs); | ||
153 | printk(KERN_DEBUG "NumOfInvalidMpeTlbs = %d", p->NumOfInvalidMpeTlbs); | ||
154 | printk(KERN_DEBUG "NumOfCorrectedMpeTlbs = %d", p->NumOfCorrectedMpeTlbs); | ||
155 | printk(KERN_DEBUG "BERErrorCount = %d", p->BERErrorCount); | ||
156 | printk(KERN_DEBUG "BERBitCount = %d", p->BERBitCount); | ||
157 | printk(KERN_DEBUG "SmsToHostTxErrors = %d", p->SmsToHostTxErrors); | ||
158 | printk(KERN_DEBUG "PreBER = %d", p->PreBER); | ||
159 | printk(KERN_DEBUG "CellId = %d", p->CellId); | ||
160 | printk(KERN_DEBUG "DvbhSrvIndHP = %d", p->DvbhSrvIndHP); | ||
161 | printk(KERN_DEBUG "DvbhSrvIndLP = %d", p->DvbhSrvIndLP); | ||
162 | printk(KERN_DEBUG "NumMPEReceived = %d", p->NumMPEReceived); | ||
163 | } | ||
164 | |||
165 | pReceptionData->IsDemodLocked = p->IsDemodLocked; | ||
166 | |||
167 | pReceptionData->SNR = p->SNR; | ||
168 | pReceptionData->BER = p->BER; | ||
169 | pReceptionData->BERErrorCount = p->BERErrorCount; | ||
170 | pReceptionData->InBandPwr = p->InBandPwr; | ||
171 | pReceptionData->ErrorTSPackets = p->ErrorTSPackets; | ||
172 | }; | ||
173 | |||
174 | |||
175 | static void smsdvb_update_isdbt_stats(struct RECEPTION_STATISTICS_S *pReceptionData, | ||
176 | struct SMSHOSTLIB_STATISTICS_ISDBT_ST *p) | ||
177 | { | ||
178 | int i; | ||
179 | |||
180 | if (sms_dbg & 2) { | ||
181 | printk(KERN_DEBUG "IsRfLocked = %d", p->IsRfLocked); | ||
182 | printk(KERN_DEBUG "IsDemodLocked = %d", p->IsDemodLocked); | ||
183 | printk(KERN_DEBUG "IsExternalLNAOn = %d", p->IsExternalLNAOn); | ||
184 | printk(KERN_DEBUG "SNR = %d", p->SNR); | ||
185 | printk(KERN_DEBUG "RSSI = %d", p->RSSI); | ||
186 | printk(KERN_DEBUG "InBandPwr = %d", p->InBandPwr); | ||
187 | printk(KERN_DEBUG "CarrierOffset = %d", p->CarrierOffset); | ||
188 | printk(KERN_DEBUG "Frequency = %d", p->Frequency); | ||
189 | printk(KERN_DEBUG "Bandwidth = %d", p->Bandwidth); | ||
190 | printk(KERN_DEBUG "TransmissionMode = %d", p->TransmissionMode); | ||
191 | printk(KERN_DEBUG "ModemState = %d", p->ModemState); | ||
192 | printk(KERN_DEBUG "GuardInterval = %d", p->GuardInterval); | ||
193 | printk(KERN_DEBUG "SystemType = %d", p->SystemType); | ||
194 | printk(KERN_DEBUG "PartialReception = %d", p->PartialReception); | ||
195 | printk(KERN_DEBUG "NumOfLayers = %d", p->NumOfLayers); | ||
196 | printk(KERN_DEBUG "SmsToHostTxErrors = %d", p->SmsToHostTxErrors); | ||
197 | |||
198 | for (i = 0; i < 3; i++) { | ||
199 | printk(KERN_DEBUG "%d: CodeRate = %d", i, p->LayerInfo[i].CodeRate); | ||
200 | printk(KERN_DEBUG "%d: Constellation = %d", i, p->LayerInfo[i].Constellation); | ||
201 | printk(KERN_DEBUG "%d: BER = %d", i, p->LayerInfo[i].BER); | ||
202 | printk(KERN_DEBUG "%d: BERErrorCount = %d", i, p->LayerInfo[i].BERErrorCount); | ||
203 | printk(KERN_DEBUG "%d: BERBitCount = %d", i, p->LayerInfo[i].BERBitCount); | ||
204 | printk(KERN_DEBUG "%d: PreBER = %d", i, p->LayerInfo[i].PreBER); | ||
205 | printk(KERN_DEBUG "%d: TS_PER = %d", i, p->LayerInfo[i].TS_PER); | ||
206 | printk(KERN_DEBUG "%d: ErrorTSPackets = %d", i, p->LayerInfo[i].ErrorTSPackets); | ||
207 | printk(KERN_DEBUG "%d: TotalTSPackets = %d", i, p->LayerInfo[i].TotalTSPackets); | ||
208 | printk(KERN_DEBUG "%d: TILdepthI = %d", i, p->LayerInfo[i].TILdepthI); | ||
209 | printk(KERN_DEBUG "%d: NumberOfSegments = %d", i, p->LayerInfo[i].NumberOfSegments); | ||
210 | printk(KERN_DEBUG "%d: TMCCErrors = %d", i, p->LayerInfo[i].TMCCErrors); | ||
211 | } | ||
212 | } | ||
213 | |||
214 | pReceptionData->IsDemodLocked = p->IsDemodLocked; | ||
215 | |||
216 | pReceptionData->SNR = p->SNR; | ||
217 | pReceptionData->InBandPwr = p->InBandPwr; | ||
218 | |||
219 | pReceptionData->ErrorTSPackets = 0; | ||
220 | pReceptionData->BER = 0; | ||
221 | pReceptionData->BERErrorCount = 0; | ||
222 | for (i = 0; i < 3; i++) { | ||
223 | pReceptionData->BER += p->LayerInfo[i].BER; | ||
224 | pReceptionData->BERErrorCount += p->LayerInfo[i].BERErrorCount; | ||
225 | pReceptionData->ErrorTSPackets += p->LayerInfo[i].ErrorTSPackets; | ||
226 | } | ||
227 | } | ||
228 | |||
229 | static int smsdvb_onresponse(void *context, struct smscore_buffer_t *cb) | ||
230 | { | ||
231 | struct smsdvb_client_t *client = (struct smsdvb_client_t *) context; | ||
232 | struct SmsMsgHdr_ST *phdr = (struct SmsMsgHdr_ST *) (((u8 *) cb->p) | ||
233 | + cb->offset); | ||
234 | u32 *pMsgData = (u32 *) phdr + 1; | ||
235 | /*u32 MsgDataLen = phdr->msgLength - sizeof(struct SmsMsgHdr_ST);*/ | ||
236 | bool is_status_update = false; | ||
237 | |||
238 | smsendian_handle_rx_message((struct SmsMsgData_ST *) phdr); | ||
239 | |||
240 | switch (phdr->msgType) { | ||
241 | case MSG_SMS_DVBT_BDA_DATA: | ||
242 | dvb_dmx_swfilter(&client->demux, (u8 *)(phdr + 1), | ||
243 | cb->size - sizeof(struct SmsMsgHdr_ST)); | ||
244 | break; | ||
245 | |||
246 | case MSG_SMS_RF_TUNE_RES: | ||
247 | case MSG_SMS_ISDBT_TUNE_RES: | ||
248 | complete(&client->tune_done); | ||
249 | break; | ||
250 | |||
251 | case MSG_SMS_SIGNAL_DETECTED_IND: | ||
252 | sms_info("MSG_SMS_SIGNAL_DETECTED_IND"); | ||
253 | client->sms_stat_dvb.TransmissionData.IsDemodLocked = true; | ||
254 | is_status_update = true; | ||
255 | break; | ||
256 | |||
257 | case MSG_SMS_NO_SIGNAL_IND: | ||
258 | sms_info("MSG_SMS_NO_SIGNAL_IND"); | ||
259 | client->sms_stat_dvb.TransmissionData.IsDemodLocked = false; | ||
260 | is_status_update = true; | ||
261 | break; | ||
262 | |||
263 | case MSG_SMS_TRANSMISSION_IND: { | ||
264 | sms_info("MSG_SMS_TRANSMISSION_IND"); | ||
265 | |||
266 | pMsgData++; | ||
267 | memcpy(&client->sms_stat_dvb.TransmissionData, pMsgData, | ||
268 | sizeof(struct TRANSMISSION_STATISTICS_S)); | ||
269 | |||
270 | /* Mo need to correct guard interval | ||
271 | * (as opposed to old statistics message). | ||
272 | */ | ||
273 | CORRECT_STAT_BANDWIDTH(client->sms_stat_dvb.TransmissionData); | ||
274 | CORRECT_STAT_TRANSMISSON_MODE( | ||
275 | client->sms_stat_dvb.TransmissionData); | ||
276 | is_status_update = true; | ||
277 | break; | ||
278 | } | ||
279 | case MSG_SMS_HO_PER_SLICES_IND: { | ||
280 | struct RECEPTION_STATISTICS_S *pReceptionData = | ||
281 | &client->sms_stat_dvb.ReceptionData; | ||
282 | struct SRVM_SIGNAL_STATUS_S SignalStatusData; | ||
283 | |||
284 | /*sms_info("MSG_SMS_HO_PER_SLICES_IND");*/ | ||
285 | pMsgData++; | ||
286 | SignalStatusData.result = pMsgData[0]; | ||
287 | SignalStatusData.snr = pMsgData[1]; | ||
288 | SignalStatusData.inBandPower = (s32) pMsgData[2]; | ||
289 | SignalStatusData.tsPackets = pMsgData[3]; | ||
290 | SignalStatusData.etsPackets = pMsgData[4]; | ||
291 | SignalStatusData.constellation = pMsgData[5]; | ||
292 | SignalStatusData.hpCode = pMsgData[6]; | ||
293 | SignalStatusData.tpsSrvIndLP = pMsgData[7] & 0x03; | ||
294 | SignalStatusData.tpsSrvIndHP = pMsgData[8] & 0x03; | ||
295 | SignalStatusData.cellId = pMsgData[9] & 0xFFFF; | ||
296 | SignalStatusData.reason = pMsgData[10]; | ||
297 | SignalStatusData.requestId = pMsgData[11]; | ||
298 | pReceptionData->IsRfLocked = pMsgData[16]; | ||
299 | pReceptionData->IsDemodLocked = pMsgData[17]; | ||
300 | pReceptionData->ModemState = pMsgData[12]; | ||
301 | pReceptionData->SNR = pMsgData[1]; | ||
302 | pReceptionData->BER = pMsgData[13]; | ||
303 | pReceptionData->RSSI = pMsgData[14]; | ||
304 | CORRECT_STAT_RSSI(client->sms_stat_dvb.ReceptionData); | ||
305 | |||
306 | pReceptionData->InBandPwr = (s32) pMsgData[2]; | ||
307 | pReceptionData->CarrierOffset = (s32) pMsgData[15]; | ||
308 | pReceptionData->TotalTSPackets = pMsgData[3]; | ||
309 | pReceptionData->ErrorTSPackets = pMsgData[4]; | ||
310 | |||
311 | /* TS PER */ | ||
312 | if ((SignalStatusData.tsPackets + SignalStatusData.etsPackets) | ||
313 | > 0) { | ||
314 | pReceptionData->TS_PER = (SignalStatusData.etsPackets | ||
315 | * 100) / (SignalStatusData.tsPackets | ||
316 | + SignalStatusData.etsPackets); | ||
317 | } else { | ||
318 | pReceptionData->TS_PER = 0; | ||
319 | } | ||
320 | |||
321 | pReceptionData->BERBitCount = pMsgData[18]; | ||
322 | pReceptionData->BERErrorCount = pMsgData[19]; | ||
323 | |||
324 | pReceptionData->MRC_SNR = pMsgData[20]; | ||
325 | pReceptionData->MRC_InBandPwr = pMsgData[21]; | ||
326 | pReceptionData->MRC_RSSI = pMsgData[22]; | ||
327 | |||
328 | is_status_update = true; | ||
329 | break; | ||
330 | } | ||
331 | case MSG_SMS_GET_STATISTICS_RES: { | ||
332 | union { | ||
333 | struct SMSHOSTLIB_STATISTICS_ISDBT_ST isdbt; | ||
334 | struct SmsMsgStatisticsInfo_ST dvb; | ||
335 | } *p = (void *) (phdr + 1); | ||
336 | struct RECEPTION_STATISTICS_S *pReceptionData = | ||
337 | &client->sms_stat_dvb.ReceptionData; | ||
338 | |||
339 | sms_info("MSG_SMS_GET_STATISTICS_RES"); | ||
340 | |||
341 | is_status_update = true; | ||
342 | |||
343 | switch (smscore_get_device_mode(client->coredev)) { | ||
344 | case DEVICE_MODE_ISDBT: | ||
345 | case DEVICE_MODE_ISDBT_BDA: | ||
346 | smsdvb_update_isdbt_stats(pReceptionData, &p->isdbt); | ||
347 | break; | ||
348 | default: | ||
349 | smsdvb_update_dvb_stats(pReceptionData, &p->dvb.Stat); | ||
350 | } | ||
351 | if (!pReceptionData->IsDemodLocked) { | ||
352 | pReceptionData->SNR = 0; | ||
353 | pReceptionData->BER = 0; | ||
354 | pReceptionData->BERErrorCount = 0; | ||
355 | pReceptionData->InBandPwr = 0; | ||
356 | pReceptionData->ErrorTSPackets = 0; | ||
357 | } | ||
358 | |||
359 | complete(&client->tune_done); | ||
360 | break; | ||
361 | } | ||
362 | default: | ||
363 | sms_info("Unhandled message %d", phdr->msgType); | ||
364 | |||
365 | } | ||
366 | smscore_putbuffer(client->coredev, cb); | ||
367 | |||
368 | if (is_status_update) { | ||
369 | if (client->sms_stat_dvb.ReceptionData.IsDemodLocked) { | ||
370 | client->fe_status = FE_HAS_SIGNAL | FE_HAS_CARRIER | ||
371 | | FE_HAS_VITERBI | FE_HAS_SYNC | FE_HAS_LOCK; | ||
372 | sms_board_dvb3_event(client, DVB3_EVENT_FE_LOCK); | ||
373 | if (client->sms_stat_dvb.ReceptionData.ErrorTSPackets | ||
374 | == 0) | ||
375 | sms_board_dvb3_event(client, DVB3_EVENT_UNC_OK); | ||
376 | else | ||
377 | sms_board_dvb3_event(client, | ||
378 | DVB3_EVENT_UNC_ERR); | ||
379 | |||
380 | } else { | ||
381 | if (client->sms_stat_dvb.ReceptionData.IsRfLocked) | ||
382 | client->fe_status = FE_HAS_SIGNAL | FE_HAS_CARRIER; | ||
383 | else | ||
384 | client->fe_status = 0; | ||
385 | sms_board_dvb3_event(client, DVB3_EVENT_FE_UNLOCK); | ||
386 | } | ||
387 | } | ||
388 | |||
389 | return 0; | ||
390 | } | ||
391 | |||
392 | static void smsdvb_unregister_client(struct smsdvb_client_t *client) | ||
393 | { | ||
394 | /* must be called under clientslock */ | ||
395 | |||
396 | list_del(&client->entry); | ||
397 | |||
398 | smscore_unregister_client(client->smsclient); | ||
399 | dvb_unregister_frontend(&client->frontend); | ||
400 | dvb_dmxdev_release(&client->dmxdev); | ||
401 | dvb_dmx_release(&client->demux); | ||
402 | dvb_unregister_adapter(&client->adapter); | ||
403 | kfree(client); | ||
404 | } | ||
405 | |||
406 | static void smsdvb_onremove(void *context) | ||
407 | { | ||
408 | kmutex_lock(&g_smsdvb_clientslock); | ||
409 | |||
410 | smsdvb_unregister_client((struct smsdvb_client_t *) context); | ||
411 | |||
412 | kmutex_unlock(&g_smsdvb_clientslock); | ||
413 | } | ||
414 | |||
415 | static int smsdvb_start_feed(struct dvb_demux_feed *feed) | ||
416 | { | ||
417 | struct smsdvb_client_t *client = | ||
418 | container_of(feed->demux, struct smsdvb_client_t, demux); | ||
419 | struct SmsMsgData_ST PidMsg; | ||
420 | |||
421 | sms_debug("add pid %d(%x)", | ||
422 | feed->pid, feed->pid); | ||
423 | |||
424 | PidMsg.xMsgHeader.msgSrcId = DVBT_BDA_CONTROL_MSG_ID; | ||
425 | PidMsg.xMsgHeader.msgDstId = HIF_TASK; | ||
426 | PidMsg.xMsgHeader.msgFlags = 0; | ||
427 | PidMsg.xMsgHeader.msgType = MSG_SMS_ADD_PID_FILTER_REQ; | ||
428 | PidMsg.xMsgHeader.msgLength = sizeof(PidMsg); | ||
429 | PidMsg.msgData[0] = feed->pid; | ||
430 | |||
431 | smsendian_handle_tx_message((struct SmsMsgHdr_ST *)&PidMsg); | ||
432 | return smsclient_sendrequest(client->smsclient, | ||
433 | &PidMsg, sizeof(PidMsg)); | ||
434 | } | ||
435 | |||
436 | static int smsdvb_stop_feed(struct dvb_demux_feed *feed) | ||
437 | { | ||
438 | struct smsdvb_client_t *client = | ||
439 | container_of(feed->demux, struct smsdvb_client_t, demux); | ||
440 | struct SmsMsgData_ST PidMsg; | ||
441 | |||
442 | sms_debug("remove pid %d(%x)", | ||
443 | feed->pid, feed->pid); | ||
444 | |||
445 | PidMsg.xMsgHeader.msgSrcId = DVBT_BDA_CONTROL_MSG_ID; | ||
446 | PidMsg.xMsgHeader.msgDstId = HIF_TASK; | ||
447 | PidMsg.xMsgHeader.msgFlags = 0; | ||
448 | PidMsg.xMsgHeader.msgType = MSG_SMS_REMOVE_PID_FILTER_REQ; | ||
449 | PidMsg.xMsgHeader.msgLength = sizeof(PidMsg); | ||
450 | PidMsg.msgData[0] = feed->pid; | ||
451 | |||
452 | smsendian_handle_tx_message((struct SmsMsgHdr_ST *)&PidMsg); | ||
453 | return smsclient_sendrequest(client->smsclient, | ||
454 | &PidMsg, sizeof(PidMsg)); | ||
455 | } | ||
456 | |||
457 | static int smsdvb_sendrequest_and_wait(struct smsdvb_client_t *client, | ||
458 | void *buffer, size_t size, | ||
459 | struct completion *completion) | ||
460 | { | ||
461 | int rc; | ||
462 | |||
463 | smsendian_handle_tx_message((struct SmsMsgHdr_ST *)buffer); | ||
464 | rc = smsclient_sendrequest(client->smsclient, buffer, size); | ||
465 | if (rc < 0) | ||
466 | return rc; | ||
467 | |||
468 | return wait_for_completion_timeout(completion, | ||
469 | msecs_to_jiffies(2000)) ? | ||
470 | 0 : -ETIME; | ||
471 | } | ||
472 | |||
473 | static int smsdvb_send_statistics_request(struct smsdvb_client_t *client) | ||
474 | { | ||
475 | int rc; | ||
476 | struct SmsMsgHdr_ST Msg = { MSG_SMS_GET_STATISTICS_REQ, | ||
477 | DVBT_BDA_CONTROL_MSG_ID, | ||
478 | HIF_TASK, | ||
479 | sizeof(struct SmsMsgHdr_ST), 0 }; | ||
480 | |||
481 | rc = smsdvb_sendrequest_and_wait(client, &Msg, sizeof(Msg), | ||
482 | &client->tune_done); | ||
483 | |||
484 | return rc; | ||
485 | } | ||
486 | |||
487 | static inline int led_feedback(struct smsdvb_client_t *client) | ||
488 | { | ||
489 | if (client->fe_status & FE_HAS_LOCK) | ||
490 | return sms_board_led_feedback(client->coredev, | ||
491 | (client->sms_stat_dvb.ReceptionData.BER | ||
492 | == 0) ? SMS_LED_HI : SMS_LED_LO); | ||
493 | else | ||
494 | return sms_board_led_feedback(client->coredev, SMS_LED_OFF); | ||
495 | } | ||
496 | |||
497 | static int smsdvb_read_status(struct dvb_frontend *fe, fe_status_t *stat) | ||
498 | { | ||
499 | int rc; | ||
500 | struct smsdvb_client_t *client; | ||
501 | client = container_of(fe, struct smsdvb_client_t, frontend); | ||
502 | |||
503 | rc = smsdvb_send_statistics_request(client); | ||
504 | |||
505 | *stat = client->fe_status; | ||
506 | |||
507 | led_feedback(client); | ||
508 | |||
509 | return rc; | ||
510 | } | ||
511 | |||
512 | static int smsdvb_read_ber(struct dvb_frontend *fe, u32 *ber) | ||
513 | { | ||
514 | int rc; | ||
515 | struct smsdvb_client_t *client; | ||
516 | client = container_of(fe, struct smsdvb_client_t, frontend); | ||
517 | |||
518 | rc = smsdvb_send_statistics_request(client); | ||
519 | |||
520 | *ber = client->sms_stat_dvb.ReceptionData.BER; | ||
521 | |||
522 | led_feedback(client); | ||
523 | |||
524 | return rc; | ||
525 | } | ||
526 | |||
527 | static int smsdvb_read_signal_strength(struct dvb_frontend *fe, u16 *strength) | ||
528 | { | ||
529 | int rc; | ||
530 | |||
531 | struct smsdvb_client_t *client; | ||
532 | client = container_of(fe, struct smsdvb_client_t, frontend); | ||
533 | |||
534 | rc = smsdvb_send_statistics_request(client); | ||
535 | |||
536 | if (client->sms_stat_dvb.ReceptionData.InBandPwr < -95) | ||
537 | *strength = 0; | ||
538 | else if (client->sms_stat_dvb.ReceptionData.InBandPwr > -29) | ||
539 | *strength = 100; | ||
540 | else | ||
541 | *strength = | ||
542 | (client->sms_stat_dvb.ReceptionData.InBandPwr | ||
543 | + 95) * 3 / 2; | ||
544 | |||
545 | led_feedback(client); | ||
546 | |||
547 | return rc; | ||
548 | } | ||
549 | |||
550 | static int smsdvb_read_snr(struct dvb_frontend *fe, u16 *snr) | ||
551 | { | ||
552 | int rc; | ||
553 | struct smsdvb_client_t *client; | ||
554 | client = container_of(fe, struct smsdvb_client_t, frontend); | ||
555 | |||
556 | rc = smsdvb_send_statistics_request(client); | ||
557 | |||
558 | *snr = client->sms_stat_dvb.ReceptionData.SNR; | ||
559 | |||
560 | led_feedback(client); | ||
561 | |||
562 | return rc; | ||
563 | } | ||
564 | |||
565 | static int smsdvb_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks) | ||
566 | { | ||
567 | int rc; | ||
568 | struct smsdvb_client_t *client; | ||
569 | client = container_of(fe, struct smsdvb_client_t, frontend); | ||
570 | |||
571 | rc = smsdvb_send_statistics_request(client); | ||
572 | |||
573 | *ucblocks = client->sms_stat_dvb.ReceptionData.ErrorTSPackets; | ||
574 | |||
575 | led_feedback(client); | ||
576 | |||
577 | return rc; | ||
578 | } | ||
579 | |||
580 | static int smsdvb_get_tune_settings(struct dvb_frontend *fe, | ||
581 | struct dvb_frontend_tune_settings *tune) | ||
582 | { | ||
583 | sms_debug(""); | ||
584 | |||
585 | tune->min_delay_ms = 400; | ||
586 | tune->step_size = 250000; | ||
587 | tune->max_drift = 0; | ||
588 | return 0; | ||
589 | } | ||
590 | |||
591 | static int smsdvb_dvbt_set_frontend(struct dvb_frontend *fe) | ||
592 | { | ||
593 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; | ||
594 | struct smsdvb_client_t *client = | ||
595 | container_of(fe, struct smsdvb_client_t, frontend); | ||
596 | |||
597 | struct { | ||
598 | struct SmsMsgHdr_ST Msg; | ||
599 | u32 Data[3]; | ||
600 | } Msg; | ||
601 | |||
602 | int ret; | ||
603 | |||
604 | client->fe_status = FE_HAS_SIGNAL; | ||
605 | client->event_fe_state = -1; | ||
606 | client->event_unc_state = -1; | ||
607 | fe->dtv_property_cache.delivery_system = SYS_DVBT; | ||
608 | |||
609 | Msg.Msg.msgSrcId = DVBT_BDA_CONTROL_MSG_ID; | ||
610 | Msg.Msg.msgDstId = HIF_TASK; | ||
611 | Msg.Msg.msgFlags = 0; | ||
612 | Msg.Msg.msgType = MSG_SMS_RF_TUNE_REQ; | ||
613 | Msg.Msg.msgLength = sizeof(Msg); | ||
614 | Msg.Data[0] = c->frequency; | ||
615 | Msg.Data[2] = 12000000; | ||
616 | |||
617 | sms_info("%s: freq %d band %d", __func__, c->frequency, | ||
618 | c->bandwidth_hz); | ||
619 | |||
620 | switch (c->bandwidth_hz / 1000000) { | ||
621 | case 8: | ||
622 | Msg.Data[1] = BW_8_MHZ; | ||
623 | break; | ||
624 | case 7: | ||
625 | Msg.Data[1] = BW_7_MHZ; | ||
626 | break; | ||
627 | case 6: | ||
628 | Msg.Data[1] = BW_6_MHZ; | ||
629 | break; | ||
630 | case 0: | ||
631 | return -EOPNOTSUPP; | ||
632 | default: | ||
633 | return -EINVAL; | ||
634 | } | ||
635 | /* Disable LNA, if any. An error is returned if no LNA is present */ | ||
636 | ret = sms_board_lna_control(client->coredev, 0); | ||
637 | if (ret == 0) { | ||
638 | fe_status_t status; | ||
639 | |||
640 | /* tune with LNA off at first */ | ||
641 | ret = smsdvb_sendrequest_and_wait(client, &Msg, sizeof(Msg), | ||
642 | &client->tune_done); | ||
643 | |||
644 | smsdvb_read_status(fe, &status); | ||
645 | |||
646 | if (status & FE_HAS_LOCK) | ||
647 | return ret; | ||
648 | |||
649 | /* previous tune didn't lock - enable LNA and tune again */ | ||
650 | sms_board_lna_control(client->coredev, 1); | ||
651 | } | ||
652 | |||
653 | return smsdvb_sendrequest_and_wait(client, &Msg, sizeof(Msg), | ||
654 | &client->tune_done); | ||
655 | } | ||
656 | |||
657 | static int smsdvb_isdbt_set_frontend(struct dvb_frontend *fe) | ||
658 | { | ||
659 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; | ||
660 | struct smsdvb_client_t *client = | ||
661 | container_of(fe, struct smsdvb_client_t, frontend); | ||
662 | |||
663 | struct { | ||
664 | struct SmsMsgHdr_ST Msg; | ||
665 | u32 Data[4]; | ||
666 | } Msg; | ||
667 | |||
668 | fe->dtv_property_cache.delivery_system = SYS_ISDBT; | ||
669 | |||
670 | Msg.Msg.msgSrcId = DVBT_BDA_CONTROL_MSG_ID; | ||
671 | Msg.Msg.msgDstId = HIF_TASK; | ||
672 | Msg.Msg.msgFlags = 0; | ||
673 | Msg.Msg.msgType = MSG_SMS_ISDBT_TUNE_REQ; | ||
674 | Msg.Msg.msgLength = sizeof(Msg); | ||
675 | |||
676 | if (c->isdbt_sb_segment_idx == -1) | ||
677 | c->isdbt_sb_segment_idx = 0; | ||
678 | |||
679 | switch (c->isdbt_sb_segment_count) { | ||
680 | case 3: | ||
681 | Msg.Data[1] = BW_ISDBT_3SEG; | ||
682 | break; | ||
683 | case 1: | ||
684 | Msg.Data[1] = BW_ISDBT_1SEG; | ||
685 | break; | ||
686 | case 0: /* AUTO */ | ||
687 | switch (c->bandwidth_hz / 1000000) { | ||
688 | case 8: | ||
689 | case 7: | ||
690 | c->isdbt_sb_segment_count = 3; | ||
691 | Msg.Data[1] = BW_ISDBT_3SEG; | ||
692 | break; | ||
693 | case 6: | ||
694 | c->isdbt_sb_segment_count = 1; | ||
695 | Msg.Data[1] = BW_ISDBT_1SEG; | ||
696 | break; | ||
697 | default: /* Assumes 6 MHZ bw */ | ||
698 | c->isdbt_sb_segment_count = 1; | ||
699 | c->bandwidth_hz = 6000; | ||
700 | Msg.Data[1] = BW_ISDBT_1SEG; | ||
701 | break; | ||
702 | } | ||
703 | break; | ||
704 | default: | ||
705 | sms_info("Segment count %d not supported", c->isdbt_sb_segment_count); | ||
706 | return -EINVAL; | ||
707 | } | ||
708 | |||
709 | Msg.Data[0] = c->frequency; | ||
710 | Msg.Data[2] = 12000000; | ||
711 | Msg.Data[3] = c->isdbt_sb_segment_idx; | ||
712 | |||
713 | sms_info("%s: freq %d segwidth %d segindex %d\n", __func__, | ||
714 | c->frequency, c->isdbt_sb_segment_count, | ||
715 | c->isdbt_sb_segment_idx); | ||
716 | |||
717 | return smsdvb_sendrequest_and_wait(client, &Msg, sizeof(Msg), | ||
718 | &client->tune_done); | ||
719 | } | ||
720 | |||
721 | static int smsdvb_set_frontend(struct dvb_frontend *fe) | ||
722 | { | ||
723 | struct smsdvb_client_t *client = | ||
724 | container_of(fe, struct smsdvb_client_t, frontend); | ||
725 | struct smscore_device_t *coredev = client->coredev; | ||
726 | |||
727 | switch (smscore_get_device_mode(coredev)) { | ||
728 | case DEVICE_MODE_DVBT: | ||
729 | case DEVICE_MODE_DVBT_BDA: | ||
730 | return smsdvb_dvbt_set_frontend(fe); | ||
731 | case DEVICE_MODE_ISDBT: | ||
732 | case DEVICE_MODE_ISDBT_BDA: | ||
733 | return smsdvb_isdbt_set_frontend(fe); | ||
734 | default: | ||
735 | return -EINVAL; | ||
736 | } | ||
737 | } | ||
738 | |||
739 | static int smsdvb_get_frontend(struct dvb_frontend *fe) | ||
740 | { | ||
741 | struct dtv_frontend_properties *fep = &fe->dtv_property_cache; | ||
742 | struct smsdvb_client_t *client = | ||
743 | container_of(fe, struct smsdvb_client_t, frontend); | ||
744 | struct smscore_device_t *coredev = client->coredev; | ||
745 | struct TRANSMISSION_STATISTICS_S *td = | ||
746 | &client->sms_stat_dvb.TransmissionData; | ||
747 | |||
748 | switch (smscore_get_device_mode(coredev)) { | ||
749 | case DEVICE_MODE_DVBT: | ||
750 | case DEVICE_MODE_DVBT_BDA: | ||
751 | fep->frequency = td->Frequency; | ||
752 | |||
753 | switch (td->Bandwidth) { | ||
754 | case 6: | ||
755 | fep->bandwidth_hz = 6000000; | ||
756 | break; | ||
757 | case 7: | ||
758 | fep->bandwidth_hz = 7000000; | ||
759 | break; | ||
760 | case 8: | ||
761 | fep->bandwidth_hz = 8000000; | ||
762 | break; | ||
763 | } | ||
764 | |||
765 | switch (td->TransmissionMode) { | ||
766 | case 2: | ||
767 | fep->transmission_mode = TRANSMISSION_MODE_2K; | ||
768 | break; | ||
769 | case 8: | ||
770 | fep->transmission_mode = TRANSMISSION_MODE_8K; | ||
771 | } | ||
772 | |||
773 | switch (td->GuardInterval) { | ||
774 | case 0: | ||
775 | fep->guard_interval = GUARD_INTERVAL_1_32; | ||
776 | break; | ||
777 | case 1: | ||
778 | fep->guard_interval = GUARD_INTERVAL_1_16; | ||
779 | break; | ||
780 | case 2: | ||
781 | fep->guard_interval = GUARD_INTERVAL_1_8; | ||
782 | break; | ||
783 | case 3: | ||
784 | fep->guard_interval = GUARD_INTERVAL_1_4; | ||
785 | break; | ||
786 | } | ||
787 | |||
788 | switch (td->CodeRate) { | ||
789 | case 0: | ||
790 | fep->code_rate_HP = FEC_1_2; | ||
791 | break; | ||
792 | case 1: | ||
793 | fep->code_rate_HP = FEC_2_3; | ||
794 | break; | ||
795 | case 2: | ||
796 | fep->code_rate_HP = FEC_3_4; | ||
797 | break; | ||
798 | case 3: | ||
799 | fep->code_rate_HP = FEC_5_6; | ||
800 | break; | ||
801 | case 4: | ||
802 | fep->code_rate_HP = FEC_7_8; | ||
803 | break; | ||
804 | } | ||
805 | |||
806 | switch (td->LPCodeRate) { | ||
807 | case 0: | ||
808 | fep->code_rate_LP = FEC_1_2; | ||
809 | break; | ||
810 | case 1: | ||
811 | fep->code_rate_LP = FEC_2_3; | ||
812 | break; | ||
813 | case 2: | ||
814 | fep->code_rate_LP = FEC_3_4; | ||
815 | break; | ||
816 | case 3: | ||
817 | fep->code_rate_LP = FEC_5_6; | ||
818 | break; | ||
819 | case 4: | ||
820 | fep->code_rate_LP = FEC_7_8; | ||
821 | break; | ||
822 | } | ||
823 | |||
824 | switch (td->Constellation) { | ||
825 | case 0: | ||
826 | fep->modulation = QPSK; | ||
827 | break; | ||
828 | case 1: | ||
829 | fep->modulation = QAM_16; | ||
830 | break; | ||
831 | case 2: | ||
832 | fep->modulation = QAM_64; | ||
833 | break; | ||
834 | } | ||
835 | |||
836 | switch (td->Hierarchy) { | ||
837 | case 0: | ||
838 | fep->hierarchy = HIERARCHY_NONE; | ||
839 | break; | ||
840 | case 1: | ||
841 | fep->hierarchy = HIERARCHY_1; | ||
842 | break; | ||
843 | case 2: | ||
844 | fep->hierarchy = HIERARCHY_2; | ||
845 | break; | ||
846 | case 3: | ||
847 | fep->hierarchy = HIERARCHY_4; | ||
848 | break; | ||
849 | } | ||
850 | |||
851 | fep->inversion = INVERSION_AUTO; | ||
852 | break; | ||
853 | case DEVICE_MODE_ISDBT: | ||
854 | case DEVICE_MODE_ISDBT_BDA: | ||
855 | fep->frequency = td->Frequency; | ||
856 | fep->bandwidth_hz = 6000000; | ||
857 | /* todo: retrive the other parameters */ | ||
858 | break; | ||
859 | default: | ||
860 | return -EINVAL; | ||
861 | } | ||
862 | |||
863 | return 0; | ||
864 | } | ||
865 | |||
866 | static int smsdvb_init(struct dvb_frontend *fe) | ||
867 | { | ||
868 | struct smsdvb_client_t *client = | ||
869 | container_of(fe, struct smsdvb_client_t, frontend); | ||
870 | |||
871 | sms_board_power(client->coredev, 1); | ||
872 | |||
873 | sms_board_dvb3_event(client, DVB3_EVENT_INIT); | ||
874 | return 0; | ||
875 | } | ||
876 | |||
877 | static int smsdvb_sleep(struct dvb_frontend *fe) | ||
878 | { | ||
879 | struct smsdvb_client_t *client = | ||
880 | container_of(fe, struct smsdvb_client_t, frontend); | ||
881 | |||
882 | sms_board_led_feedback(client->coredev, SMS_LED_OFF); | ||
883 | sms_board_power(client->coredev, 0); | ||
884 | |||
885 | sms_board_dvb3_event(client, DVB3_EVENT_SLEEP); | ||
886 | |||
887 | return 0; | ||
888 | } | ||
889 | |||
890 | static void smsdvb_release(struct dvb_frontend *fe) | ||
891 | { | ||
892 | /* do nothing */ | ||
893 | } | ||
894 | |||
895 | static struct dvb_frontend_ops smsdvb_fe_ops = { | ||
896 | .info = { | ||
897 | .name = "Siano Mobile Digital MDTV Receiver", | ||
898 | .frequency_min = 44250000, | ||
899 | .frequency_max = 867250000, | ||
900 | .frequency_stepsize = 250000, | ||
901 | .caps = FE_CAN_INVERSION_AUTO | | ||
902 | FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 | | ||
903 | FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO | | ||
904 | FE_CAN_QPSK | FE_CAN_QAM_16 | FE_CAN_QAM_64 | | ||
905 | FE_CAN_QAM_AUTO | FE_CAN_TRANSMISSION_MODE_AUTO | | ||
906 | FE_CAN_GUARD_INTERVAL_AUTO | | ||
907 | FE_CAN_RECOVER | | ||
908 | FE_CAN_HIERARCHY_AUTO, | ||
909 | }, | ||
910 | |||
911 | .release = smsdvb_release, | ||
912 | |||
913 | .set_frontend = smsdvb_set_frontend, | ||
914 | .get_frontend = smsdvb_get_frontend, | ||
915 | .get_tune_settings = smsdvb_get_tune_settings, | ||
916 | |||
917 | .read_status = smsdvb_read_status, | ||
918 | .read_ber = smsdvb_read_ber, | ||
919 | .read_signal_strength = smsdvb_read_signal_strength, | ||
920 | .read_snr = smsdvb_read_snr, | ||
921 | .read_ucblocks = smsdvb_read_ucblocks, | ||
922 | |||
923 | .init = smsdvb_init, | ||
924 | .sleep = smsdvb_sleep, | ||
925 | }; | ||
926 | |||
927 | static int smsdvb_hotplug(struct smscore_device_t *coredev, | ||
928 | struct device *device, int arrival) | ||
929 | { | ||
930 | struct smsclient_params_t params; | ||
931 | struct smsdvb_client_t *client; | ||
932 | int rc; | ||
933 | |||
934 | /* device removal handled by onremove callback */ | ||
935 | if (!arrival) | ||
936 | return 0; | ||
937 | client = kzalloc(sizeof(struct smsdvb_client_t), GFP_KERNEL); | ||
938 | if (!client) { | ||
939 | sms_err("kmalloc() failed"); | ||
940 | return -ENOMEM; | ||
941 | } | ||
942 | |||
943 | /* register dvb adapter */ | ||
944 | rc = dvb_register_adapter(&client->adapter, | ||
945 | sms_get_board( | ||
946 | smscore_get_board_id(coredev))->name, | ||
947 | THIS_MODULE, device, adapter_nr); | ||
948 | if (rc < 0) { | ||
949 | sms_err("dvb_register_adapter() failed %d", rc); | ||
950 | goto adapter_error; | ||
951 | } | ||
952 | |||
953 | /* init dvb demux */ | ||
954 | client->demux.dmx.capabilities = DMX_TS_FILTERING; | ||
955 | client->demux.filternum = 32; /* todo: nova ??? */ | ||
956 | client->demux.feednum = 32; | ||
957 | client->demux.start_feed = smsdvb_start_feed; | ||
958 | client->demux.stop_feed = smsdvb_stop_feed; | ||
959 | |||
960 | rc = dvb_dmx_init(&client->demux); | ||
961 | if (rc < 0) { | ||
962 | sms_err("dvb_dmx_init failed %d", rc); | ||
963 | goto dvbdmx_error; | ||
964 | } | ||
965 | |||
966 | /* init dmxdev */ | ||
967 | client->dmxdev.filternum = 32; | ||
968 | client->dmxdev.demux = &client->demux.dmx; | ||
969 | client->dmxdev.capabilities = 0; | ||
970 | |||
971 | rc = dvb_dmxdev_init(&client->dmxdev, &client->adapter); | ||
972 | if (rc < 0) { | ||
973 | sms_err("dvb_dmxdev_init failed %d", rc); | ||
974 | goto dmxdev_error; | ||
975 | } | ||
976 | |||
977 | /* init and register frontend */ | ||
978 | memcpy(&client->frontend.ops, &smsdvb_fe_ops, | ||
979 | sizeof(struct dvb_frontend_ops)); | ||
980 | |||
981 | switch (smscore_get_device_mode(coredev)) { | ||
982 | case DEVICE_MODE_DVBT: | ||
983 | case DEVICE_MODE_DVBT_BDA: | ||
984 | client->frontend.ops.delsys[0] = SYS_DVBT; | ||
985 | break; | ||
986 | case DEVICE_MODE_ISDBT: | ||
987 | case DEVICE_MODE_ISDBT_BDA: | ||
988 | client->frontend.ops.delsys[0] = SYS_ISDBT; | ||
989 | break; | ||
990 | } | ||
991 | |||
992 | rc = dvb_register_frontend(&client->adapter, &client->frontend); | ||
993 | if (rc < 0) { | ||
994 | sms_err("frontend registration failed %d", rc); | ||
995 | goto frontend_error; | ||
996 | } | ||
997 | |||
998 | params.initial_id = 1; | ||
999 | params.data_type = MSG_SMS_DVBT_BDA_DATA; | ||
1000 | params.onresponse_handler = smsdvb_onresponse; | ||
1001 | params.onremove_handler = smsdvb_onremove; | ||
1002 | params.context = client; | ||
1003 | |||
1004 | rc = smscore_register_client(coredev, ¶ms, &client->smsclient); | ||
1005 | if (rc < 0) { | ||
1006 | sms_err("smscore_register_client() failed %d", rc); | ||
1007 | goto client_error; | ||
1008 | } | ||
1009 | |||
1010 | client->coredev = coredev; | ||
1011 | |||
1012 | init_completion(&client->tune_done); | ||
1013 | |||
1014 | kmutex_lock(&g_smsdvb_clientslock); | ||
1015 | |||
1016 | list_add(&client->entry, &g_smsdvb_clients); | ||
1017 | |||
1018 | kmutex_unlock(&g_smsdvb_clientslock); | ||
1019 | |||
1020 | client->event_fe_state = -1; | ||
1021 | client->event_unc_state = -1; | ||
1022 | sms_board_dvb3_event(client, DVB3_EVENT_HOTPLUG); | ||
1023 | |||
1024 | sms_info("success"); | ||
1025 | sms_board_setup(coredev); | ||
1026 | |||
1027 | return 0; | ||
1028 | |||
1029 | client_error: | ||
1030 | dvb_unregister_frontend(&client->frontend); | ||
1031 | |||
1032 | frontend_error: | ||
1033 | dvb_dmxdev_release(&client->dmxdev); | ||
1034 | |||
1035 | dmxdev_error: | ||
1036 | dvb_dmx_release(&client->demux); | ||
1037 | |||
1038 | dvbdmx_error: | ||
1039 | dvb_unregister_adapter(&client->adapter); | ||
1040 | |||
1041 | adapter_error: | ||
1042 | kfree(client); | ||
1043 | return rc; | ||
1044 | } | ||
1045 | |||
1046 | static int __init smsdvb_module_init(void) | ||
1047 | { | ||
1048 | int rc; | ||
1049 | |||
1050 | INIT_LIST_HEAD(&g_smsdvb_clients); | ||
1051 | kmutex_init(&g_smsdvb_clientslock); | ||
1052 | |||
1053 | rc = smscore_register_hotplug(smsdvb_hotplug); | ||
1054 | |||
1055 | sms_debug(""); | ||
1056 | |||
1057 | return rc; | ||
1058 | } | ||
1059 | |||
1060 | static void __exit smsdvb_module_exit(void) | ||
1061 | { | ||
1062 | smscore_unregister_hotplug(smsdvb_hotplug); | ||
1063 | |||
1064 | kmutex_lock(&g_smsdvb_clientslock); | ||
1065 | |||
1066 | while (!list_empty(&g_smsdvb_clients)) | ||
1067 | smsdvb_unregister_client( | ||
1068 | (struct smsdvb_client_t *) g_smsdvb_clients.next); | ||
1069 | |||
1070 | kmutex_unlock(&g_smsdvb_clientslock); | ||
1071 | } | ||
1072 | |||
1073 | module_init(smsdvb_module_init); | ||
1074 | module_exit(smsdvb_module_exit); | ||
1075 | |||
1076 | MODULE_DESCRIPTION("SMS DVB subsystem adaptation module"); | ||
1077 | MODULE_AUTHOR("Siano Mobile Silicon, Inc. (uris@siano-ms.com)"); | ||
1078 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/media/common/siano/smsdvb.h b/drivers/media/common/siano/smsdvb.h new file mode 100644 index 000000000000..92c413ba0c79 --- /dev/null +++ b/drivers/media/common/siano/smsdvb.h | |||
@@ -0,0 +1,130 @@ | |||
1 | /*********************************************************************** | ||
2 | * | ||
3 | * This program is free software: you can redistribute it and/or modify | ||
4 | * it under the terms of the GNU General Public License as published by | ||
5 | * the Free Software Foundation, either version 2 of the License, or | ||
6 | * (at your option) any later version. | ||
7 | |||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | * | ||
16 | ***********************************************************************/ | ||
17 | |||
18 | struct smsdvb_debugfs; | ||
19 | struct smsdvb_client_t; | ||
20 | |||
21 | typedef void (*sms_prt_dvb_stats_t)(struct smsdvb_debugfs *debug_data, | ||
22 | struct sms_stats *p); | ||
23 | |||
24 | typedef void (*sms_prt_isdb_stats_t)(struct smsdvb_debugfs *debug_data, | ||
25 | struct sms_isdbt_stats *p); | ||
26 | |||
27 | typedef void (*sms_prt_isdb_stats_ex_t) | ||
28 | (struct smsdvb_debugfs *debug_data, | ||
29 | struct sms_isdbt_stats_ex *p); | ||
30 | |||
31 | |||
32 | struct smsdvb_client_t { | ||
33 | struct list_head entry; | ||
34 | |||
35 | struct smscore_device_t *coredev; | ||
36 | struct smscore_client_t *smsclient; | ||
37 | |||
38 | struct dvb_adapter adapter; | ||
39 | struct dvb_demux demux; | ||
40 | struct dmxdev dmxdev; | ||
41 | struct dvb_frontend frontend; | ||
42 | |||
43 | fe_status_t fe_status; | ||
44 | |||
45 | struct completion tune_done; | ||
46 | struct completion stats_done; | ||
47 | |||
48 | int last_per; | ||
49 | |||
50 | int legacy_ber, legacy_per; | ||
51 | |||
52 | int event_fe_state; | ||
53 | int event_unc_state; | ||
54 | |||
55 | unsigned long get_stats_jiffies; | ||
56 | |||
57 | int feed_users; | ||
58 | bool has_tuned; | ||
59 | |||
60 | /* stats debugfs data */ | ||
61 | struct dentry *debugfs; | ||
62 | |||
63 | struct smsdvb_debugfs *debug_data; | ||
64 | |||
65 | sms_prt_dvb_stats_t prt_dvb_stats; | ||
66 | sms_prt_isdb_stats_t prt_isdb_stats; | ||
67 | sms_prt_isdb_stats_ex_t prt_isdb_stats_ex; | ||
68 | }; | ||
69 | |||
70 | /* | ||
71 | * This struct is a mix of struct sms_rx_stats_ex and | ||
72 | * struct sms_srvm_signal_status. | ||
73 | * It was obtained by comparing the way it was filled by the original code | ||
74 | */ | ||
75 | struct RECEPTION_STATISTICS_PER_SLICES_S { | ||
76 | u32 result; | ||
77 | u32 snr; | ||
78 | s32 in_band_power; | ||
79 | u32 ts_packets; | ||
80 | u32 ets_packets; | ||
81 | u32 constellation; | ||
82 | u32 hp_code; | ||
83 | u32 tps_srv_ind_lp; | ||
84 | u32 tps_srv_ind_hp; | ||
85 | u32 cell_id; | ||
86 | u32 reason; | ||
87 | u32 request_id; | ||
88 | u32 modem_state; /* from SMSHOSTLIB_DVB_MODEM_STATE_ET */ | ||
89 | |||
90 | u32 ber; /* Post Viterbi BER [1E-5] */ | ||
91 | s32 RSSI; /* dBm */ | ||
92 | s32 carrier_offset; /* Carrier Offset in bin/1024 */ | ||
93 | |||
94 | u32 is_rf_locked; /* 0 - not locked, 1 - locked */ | ||
95 | u32 is_demod_locked; /* 0 - not locked, 1 - locked */ | ||
96 | |||
97 | u32 ber_bit_count; /* Total number of SYNC bits. */ | ||
98 | u32 ber_error_count; /* Number of erronous SYNC bits. */ | ||
99 | |||
100 | s32 MRC_SNR; /* dB */ | ||
101 | s32 mrc_in_band_pwr; /* In band power in dBM */ | ||
102 | s32 MRC_RSSI; /* dBm */ | ||
103 | }; | ||
104 | |||
105 | /* From smsdvb-debugfs.c */ | ||
106 | #ifdef CONFIG_SMS_SIANO_DEBUGFS | ||
107 | |||
108 | int smsdvb_debugfs_create(struct smsdvb_client_t *client); | ||
109 | void smsdvb_debugfs_release(struct smsdvb_client_t *client); | ||
110 | int smsdvb_debugfs_register(void); | ||
111 | void smsdvb_debugfs_unregister(void); | ||
112 | |||
113 | #else | ||
114 | |||
115 | static inline int smsdvb_debugfs_create(struct smsdvb_client_t *client) | ||
116 | { | ||
117 | return 0; | ||
118 | } | ||
119 | |||
120 | static inline void smsdvb_debugfs_release(struct smsdvb_client_t *client) {} | ||
121 | |||
122 | static inline int smsdvb_debugfs_register(void) | ||
123 | { | ||
124 | return 0; | ||
125 | }; | ||
126 | |||
127 | static inline void smsdvb_debugfs_unregister(void) {}; | ||
128 | |||
129 | #endif | ||
130 | |||
diff --git a/drivers/media/common/siano/smsendian.c b/drivers/media/common/siano/smsendian.c index e2657c2f0109..bfe831c10b1c 100644 --- a/drivers/media/common/siano/smsendian.c +++ b/drivers/media/common/siano/smsendian.c | |||
@@ -28,23 +28,23 @@ | |||
28 | void smsendian_handle_tx_message(void *buffer) | 28 | void smsendian_handle_tx_message(void *buffer) |
29 | { | 29 | { |
30 | #ifdef __BIG_ENDIAN | 30 | #ifdef __BIG_ENDIAN |
31 | struct SmsMsgData_ST *msg = (struct SmsMsgData_ST *)buffer; | 31 | struct sms_msg_data *msg = (struct sms_msg_data *)buffer; |
32 | int i; | 32 | int i; |
33 | int msgWords; | 33 | int msg_words; |
34 | 34 | ||
35 | switch (msg->xMsgHeader.msgType) { | 35 | switch (msg->x_msg_header.msg_type) { |
36 | case MSG_SMS_DATA_DOWNLOAD_REQ: | 36 | case MSG_SMS_DATA_DOWNLOAD_REQ: |
37 | { | 37 | { |
38 | msg->msgData[0] = le32_to_cpu(msg->msgData[0]); | 38 | msg->msg_data[0] = le32_to_cpu(msg->msg_data[0]); |
39 | break; | 39 | break; |
40 | } | 40 | } |
41 | 41 | ||
42 | default: | 42 | default: |
43 | msgWords = (msg->xMsgHeader.msgLength - | 43 | msg_words = (msg->x_msg_header.msg_length - |
44 | sizeof(struct SmsMsgHdr_ST))/4; | 44 | sizeof(struct sms_msg_hdr))/4; |
45 | 45 | ||
46 | for (i = 0; i < msgWords; i++) | 46 | for (i = 0; i < msg_words; i++) |
47 | msg->msgData[i] = le32_to_cpu(msg->msgData[i]); | 47 | msg->msg_data[i] = le32_to_cpu(msg->msg_data[i]); |
48 | 48 | ||
49 | break; | 49 | break; |
50 | } | 50 | } |
@@ -55,16 +55,16 @@ EXPORT_SYMBOL_GPL(smsendian_handle_tx_message); | |||
55 | void smsendian_handle_rx_message(void *buffer) | 55 | void smsendian_handle_rx_message(void *buffer) |
56 | { | 56 | { |
57 | #ifdef __BIG_ENDIAN | 57 | #ifdef __BIG_ENDIAN |
58 | struct SmsMsgData_ST *msg = (struct SmsMsgData_ST *)buffer; | 58 | struct sms_msg_data *msg = (struct sms_msg_data *)buffer; |
59 | int i; | 59 | int i; |
60 | int msgWords; | 60 | int msg_words; |
61 | 61 | ||
62 | switch (msg->xMsgHeader.msgType) { | 62 | switch (msg->x_msg_header.msg_type) { |
63 | case MSG_SMS_GET_VERSION_EX_RES: | 63 | case MSG_SMS_GET_VERSION_EX_RES: |
64 | { | 64 | { |
65 | struct SmsVersionRes_ST *ver = | 65 | struct sms_version_res *ver = |
66 | (struct SmsVersionRes_ST *) msg; | 66 | (struct sms_version_res *) msg; |
67 | ver->ChipModel = le16_to_cpu(ver->ChipModel); | 67 | ver->chip_model = le16_to_cpu(ver->chip_model); |
68 | break; | 68 | break; |
69 | } | 69 | } |
70 | 70 | ||
@@ -77,11 +77,11 @@ void smsendian_handle_rx_message(void *buffer) | |||
77 | 77 | ||
78 | default: | 78 | default: |
79 | { | 79 | { |
80 | msgWords = (msg->xMsgHeader.msgLength - | 80 | msg_words = (msg->x_msg_header.msg_length - |
81 | sizeof(struct SmsMsgHdr_ST))/4; | 81 | sizeof(struct sms_msg_hdr))/4; |
82 | 82 | ||
83 | for (i = 0; i < msgWords; i++) | 83 | for (i = 0; i < msg_words; i++) |
84 | msg->msgData[i] = le32_to_cpu(msg->msgData[i]); | 84 | msg->msg_data[i] = le32_to_cpu(msg->msg_data[i]); |
85 | 85 | ||
86 | break; | 86 | break; |
87 | } | 87 | } |
@@ -93,11 +93,11 @@ EXPORT_SYMBOL_GPL(smsendian_handle_rx_message); | |||
93 | void smsendian_handle_message_header(void *msg) | 93 | void smsendian_handle_message_header(void *msg) |
94 | { | 94 | { |
95 | #ifdef __BIG_ENDIAN | 95 | #ifdef __BIG_ENDIAN |
96 | struct SmsMsgHdr_ST *phdr = (struct SmsMsgHdr_ST *)msg; | 96 | struct sms_msg_hdr *phdr = (struct sms_msg_hdr *)msg; |
97 | 97 | ||
98 | phdr->msgType = le16_to_cpu(phdr->msgType); | 98 | phdr->msg_type = le16_to_cpu(phdr->msg_type); |
99 | phdr->msgLength = le16_to_cpu(phdr->msgLength); | 99 | phdr->msg_length = le16_to_cpu(phdr->msg_length); |
100 | phdr->msgFlags = le16_to_cpu(phdr->msgFlags); | 100 | phdr->msg_flags = le16_to_cpu(phdr->msg_flags); |
101 | #endif /* __BIG_ENDIAN */ | 101 | #endif /* __BIG_ENDIAN */ |
102 | } | 102 | } |
103 | EXPORT_SYMBOL_GPL(smsendian_handle_message_header); | 103 | EXPORT_SYMBOL_GPL(smsendian_handle_message_header); |
diff --git a/drivers/media/common/siano/smsir.h b/drivers/media/common/siano/smsir.h index 69b59b9eee28..fc8b7925c532 100644 --- a/drivers/media/common/siano/smsir.h +++ b/drivers/media/common/siano/smsir.h | |||
@@ -40,7 +40,6 @@ struct ir_t { | |||
40 | char phys[32]; | 40 | char phys[32]; |
41 | 41 | ||
42 | char *rc_codes; | 42 | char *rc_codes; |
43 | u64 protocol; | ||
44 | 43 | ||
45 | u32 timeout; | 44 | u32 timeout; |
46 | u32 controller; | 45 | u32 controller; |