2009-04-27 20:09:47 +08:00
|
|
|
/****************************************************************
|
|
|
|
|
|
|
|
Siano Mobile Silicon, Inc.
|
|
|
|
MDTV receiver kernel modules.
|
|
|
|
Copyright (C) 2006-2008, Uri Shkolnik
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
****************************************************************/
|
2008-05-23 05:05:26 +08:00
|
|
|
|
2015-02-22 21:46:56 +08:00
|
|
|
#include "smscoreapi.h"
|
|
|
|
|
2008-05-20 05:56:13 +08:00
|
|
|
#include <linux/module.h>
|
include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.
percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.
http://userweb.kernel.org/~tj/misc/slabh-sweep.py
The script does the followings.
* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.
* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.
* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.
The conversion was done in the following steps.
1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.
2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.
3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.
4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.
5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.
6. percpu.h was updated not to include slab.h.
7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).
* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig
8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.
Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.
Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
2010-03-24 16:04:11 +08:00
|
|
|
#include <linux/slab.h>
|
2008-05-20 05:56:13 +08:00
|
|
|
#include <linux/init.h>
|
2013-03-22 17:22:45 +08:00
|
|
|
#include <asm/div64.h>
|
2008-05-20 05:56:13 +08:00
|
|
|
|
2009-05-15 03:28:17 +08:00
|
|
|
#include "dmxdev.h"
|
|
|
|
#include "dvbdev.h"
|
|
|
|
#include "dvb_demux.h"
|
|
|
|
#include "dvb_frontend.h"
|
|
|
|
|
2008-06-19 09:09:55 +08:00
|
|
|
#include "sms-cards.h"
|
2008-05-20 05:56:13 +08:00
|
|
|
|
2013-03-10 20:04:44 +08:00
|
|
|
#include "smsdvb.h"
|
2008-09-01 04:15:47 +08:00
|
|
|
|
2013-03-10 20:04:44 +08:00
|
|
|
DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
|
2008-09-01 04:15:47 +08:00
|
|
|
|
2008-07-22 10:17:36 +08:00
|
|
|
static struct list_head g_smsdvb_clients;
|
|
|
|
static struct mutex g_smsdvb_clientslock;
|
2008-05-20 05:56:13 +08:00
|
|
|
|
2013-10-04 22:01:52 +08:00
|
|
|
static u32 sms_to_guard_interval_table[] = {
|
2013-03-10 06:26:28 +08:00
|
|
|
[0] = GUARD_INTERVAL_1_32,
|
|
|
|
[1] = GUARD_INTERVAL_1_16,
|
|
|
|
[2] = GUARD_INTERVAL_1_8,
|
|
|
|
[3] = GUARD_INTERVAL_1_4,
|
|
|
|
};
|
|
|
|
|
2013-10-04 22:01:52 +08:00
|
|
|
static u32 sms_to_code_rate_table[] = {
|
2013-03-10 06:26:28 +08:00
|
|
|
[0] = FEC_1_2,
|
|
|
|
[1] = FEC_2_3,
|
|
|
|
[2] = FEC_3_4,
|
|
|
|
[3] = FEC_5_6,
|
|
|
|
[4] = FEC_7_8,
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2013-10-04 22:01:52 +08:00
|
|
|
static u32 sms_to_hierarchy_table[] = {
|
2013-03-10 06:26:28 +08:00
|
|
|
[0] = HIERARCHY_NONE,
|
|
|
|
[1] = HIERARCHY_1,
|
|
|
|
[2] = HIERARCHY_2,
|
|
|
|
[3] = HIERARCHY_4,
|
|
|
|
};
|
|
|
|
|
2013-10-04 22:01:52 +08:00
|
|
|
static u32 sms_to_modulation_table[] = {
|
2013-03-10 06:26:28 +08:00
|
|
|
[0] = QPSK,
|
|
|
|
[1] = QAM_16,
|
|
|
|
[2] = QAM_64,
|
|
|
|
[3] = DQPSK,
|
|
|
|
};
|
|
|
|
|
2013-03-10 02:54:46 +08:00
|
|
|
|
2009-05-12 23:28:46 +08:00
|
|
|
/* Events that may come from DVB v3 adapter */
|
|
|
|
static void sms_board_dvb3_event(struct smsdvb_client_t *client,
|
|
|
|
enum SMS_DVB3_EVENTS event) {
|
2009-05-19 23:28:02 +08:00
|
|
|
|
|
|
|
struct smscore_device_t *coredev = client->coredev;
|
|
|
|
switch (event) {
|
|
|
|
case DVB3_EVENT_INIT:
|
2015-02-22 22:33:37 +08:00
|
|
|
pr_debug("DVB3_EVENT_INIT\n");
|
2009-05-19 23:28:02 +08:00
|
|
|
sms_board_event(coredev, BOARD_EVENT_BIND);
|
|
|
|
break;
|
|
|
|
case DVB3_EVENT_SLEEP:
|
2015-02-22 22:33:37 +08:00
|
|
|
pr_debug("DVB3_EVENT_SLEEP\n");
|
2009-05-19 23:28:02 +08:00
|
|
|
sms_board_event(coredev, BOARD_EVENT_POWER_SUSPEND);
|
|
|
|
break;
|
|
|
|
case DVB3_EVENT_HOTPLUG:
|
2015-02-22 22:33:37 +08:00
|
|
|
pr_debug("DVB3_EVENT_HOTPLUG\n");
|
2009-05-19 23:28:02 +08:00
|
|
|
sms_board_event(coredev, BOARD_EVENT_POWER_INIT);
|
|
|
|
break;
|
|
|
|
case DVB3_EVENT_FE_LOCK:
|
|
|
|
if (client->event_fe_state != DVB3_EVENT_FE_LOCK) {
|
|
|
|
client->event_fe_state = DVB3_EVENT_FE_LOCK;
|
2015-02-22 22:33:37 +08:00
|
|
|
pr_debug("DVB3_EVENT_FE_LOCK\n");
|
2009-05-19 23:28:02 +08:00
|
|
|
sms_board_event(coredev, BOARD_EVENT_FE_LOCK);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case DVB3_EVENT_FE_UNLOCK:
|
|
|
|
if (client->event_fe_state != DVB3_EVENT_FE_UNLOCK) {
|
|
|
|
client->event_fe_state = DVB3_EVENT_FE_UNLOCK;
|
2015-02-22 22:33:37 +08:00
|
|
|
pr_debug("DVB3_EVENT_FE_UNLOCK\n");
|
2009-05-19 23:28:02 +08:00
|
|
|
sms_board_event(coredev, BOARD_EVENT_FE_UNLOCK);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case DVB3_EVENT_UNC_OK:
|
|
|
|
if (client->event_unc_state != DVB3_EVENT_UNC_OK) {
|
|
|
|
client->event_unc_state = DVB3_EVENT_UNC_OK;
|
2015-02-22 22:33:37 +08:00
|
|
|
pr_debug("DVB3_EVENT_UNC_OK\n");
|
2009-05-19 23:28:02 +08:00
|
|
|
sms_board_event(coredev, BOARD_EVENT_MULTIPLEX_OK);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case DVB3_EVENT_UNC_ERR:
|
|
|
|
if (client->event_unc_state != DVB3_EVENT_UNC_ERR) {
|
|
|
|
client->event_unc_state = DVB3_EVENT_UNC_ERR;
|
2015-02-22 22:33:37 +08:00
|
|
|
pr_debug("DVB3_EVENT_UNC_ERR\n");
|
2009-05-19 23:28:02 +08:00
|
|
|
sms_board_event(coredev, BOARD_EVENT_MULTIPLEX_ERRORS);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2015-02-22 22:04:35 +08:00
|
|
|
pr_err("Unknown dvb3 api event\n");
|
2009-05-19 23:28:02 +08:00
|
|
|
break;
|
|
|
|
}
|
2009-05-12 23:28:46 +08:00
|
|
|
}
|
|
|
|
|
2013-03-10 06:26:28 +08:00
|
|
|
static void smsdvb_stats_not_ready(struct dvb_frontend *fe)
|
|
|
|
{
|
|
|
|
struct smsdvb_client_t *client =
|
|
|
|
container_of(fe, struct smsdvb_client_t, frontend);
|
|
|
|
struct smscore_device_t *coredev = client->coredev;
|
|
|
|
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
|
|
|
|
int i, n_layers;
|
|
|
|
|
|
|
|
switch (smscore_get_device_mode(coredev)) {
|
|
|
|
case DEVICE_MODE_ISDBT:
|
|
|
|
case DEVICE_MODE_ISDBT_BDA:
|
|
|
|
n_layers = 4;
|
2013-05-19 20:30:23 +08:00
|
|
|
break;
|
2013-03-10 06:26:28 +08:00
|
|
|
default:
|
|
|
|
n_layers = 1;
|
|
|
|
}
|
|
|
|
|
2013-03-10 23:06:30 +08:00
|
|
|
/* Global stats */
|
2013-03-10 06:26:28 +08:00
|
|
|
c->strength.len = 1;
|
|
|
|
c->cnr.len = 1;
|
2013-03-10 23:06:30 +08:00
|
|
|
c->strength.stat[0].scale = FE_SCALE_DECIBEL;
|
|
|
|
c->cnr.stat[0].scale = FE_SCALE_DECIBEL;
|
2013-03-10 06:26:28 +08:00
|
|
|
|
|
|
|
/* Per-layer stats */
|
|
|
|
c->post_bit_error.len = n_layers;
|
|
|
|
c->post_bit_count.len = n_layers;
|
|
|
|
c->block_error.len = n_layers;
|
|
|
|
c->block_count.len = n_layers;
|
|
|
|
|
2013-03-10 23:06:30 +08:00
|
|
|
/*
|
|
|
|
* Put all of them at FE_SCALE_NOT_AVAILABLE. They're dynamically
|
|
|
|
* changed when the stats become available.
|
|
|
|
*/
|
2013-03-10 06:26:28 +08:00
|
|
|
for (i = 0; i < n_layers; i++) {
|
|
|
|
c->post_bit_error.stat[i].scale = FE_SCALE_NOT_AVAILABLE;
|
|
|
|
c->post_bit_count.stat[i].scale = FE_SCALE_NOT_AVAILABLE;
|
|
|
|
c->block_error.stat[i].scale = FE_SCALE_NOT_AVAILABLE;
|
|
|
|
c->block_count.stat[i].scale = FE_SCALE_NOT_AVAILABLE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int sms_to_mode(u32 mode)
|
|
|
|
{
|
|
|
|
switch (mode) {
|
|
|
|
case 2:
|
|
|
|
return TRANSMISSION_MODE_2K;
|
|
|
|
case 4:
|
|
|
|
return TRANSMISSION_MODE_4K;
|
|
|
|
case 8:
|
|
|
|
return TRANSMISSION_MODE_8K;
|
|
|
|
}
|
|
|
|
return TRANSMISSION_MODE_AUTO;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int sms_to_status(u32 is_demod_locked, u32 is_rf_locked)
|
|
|
|
{
|
|
|
|
if (is_demod_locked)
|
|
|
|
return FE_HAS_SIGNAL | FE_HAS_CARRIER | FE_HAS_VITERBI |
|
|
|
|
FE_HAS_SYNC | FE_HAS_LOCK;
|
|
|
|
|
|
|
|
if (is_rf_locked)
|
|
|
|
return FE_HAS_SIGNAL | FE_HAS_CARRIER;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-03-11 06:21:13 +08:00
|
|
|
static inline u32 sms_to_bw(u32 value)
|
|
|
|
{
|
|
|
|
return value * 1000000;
|
|
|
|
}
|
2013-03-10 06:26:28 +08:00
|
|
|
|
|
|
|
#define convert_from_table(value, table, defval) ({ \
|
|
|
|
u32 __ret; \
|
|
|
|
if (value < ARRAY_SIZE(table)) \
|
|
|
|
__ret = table[value]; \
|
|
|
|
else \
|
|
|
|
__ret = defval; \
|
|
|
|
__ret; \
|
|
|
|
})
|
|
|
|
|
|
|
|
#define sms_to_guard_interval(value) \
|
|
|
|
convert_from_table(value, sms_to_guard_interval_table, \
|
|
|
|
GUARD_INTERVAL_AUTO);
|
|
|
|
|
|
|
|
#define sms_to_code_rate(value) \
|
|
|
|
convert_from_table(value, sms_to_code_rate_table, \
|
|
|
|
FEC_NONE);
|
|
|
|
|
|
|
|
#define sms_to_hierarchy(value) \
|
|
|
|
convert_from_table(value, sms_to_hierarchy_table, \
|
|
|
|
FEC_NONE);
|
|
|
|
|
|
|
|
#define sms_to_modulation(value) \
|
|
|
|
convert_from_table(value, sms_to_modulation_table, \
|
|
|
|
FEC_NONE);
|
|
|
|
|
|
|
|
static void smsdvb_update_tx_params(struct smsdvb_client_t *client,
|
2013-03-21 20:06:03 +08:00
|
|
|
struct sms_tx_stats *p)
|
2013-03-10 06:26:28 +08:00
|
|
|
{
|
|
|
|
struct dvb_frontend *fe = &client->frontend;
|
|
|
|
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
|
|
|
|
|
2013-03-21 19:49:43 +08:00
|
|
|
c->frequency = p->frequency;
|
|
|
|
client->fe_status = sms_to_status(p->is_demod_locked, 0);
|
|
|
|
c->bandwidth_hz = sms_to_bw(p->bandwidth);
|
|
|
|
c->transmission_mode = sms_to_mode(p->transmission_mode);
|
|
|
|
c->guard_interval = sms_to_guard_interval(p->guard_interval);
|
|
|
|
c->code_rate_HP = sms_to_code_rate(p->code_rate);
|
|
|
|
c->code_rate_LP = sms_to_code_rate(p->lp_code_rate);
|
|
|
|
c->hierarchy = sms_to_hierarchy(p->hierarchy);
|
|
|
|
c->modulation = sms_to_modulation(p->constellation);
|
2013-03-10 06:26:28 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void smsdvb_update_per_slices(struct smsdvb_client_t *client,
|
|
|
|
struct RECEPTION_STATISTICS_PER_SLICES_S *p)
|
|
|
|
{
|
|
|
|
struct dvb_frontend *fe = &client->frontend;
|
|
|
|
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
|
2013-03-22 17:22:45 +08:00
|
|
|
u64 tmp;
|
2013-03-10 06:26:28 +08:00
|
|
|
|
2013-03-21 19:49:43 +08:00
|
|
|
client->fe_status = sms_to_status(p->is_demod_locked, p->is_rf_locked);
|
2013-03-10 06:26:28 +08:00
|
|
|
c->modulation = sms_to_modulation(p->constellation);
|
|
|
|
|
2013-03-21 19:49:43 +08:00
|
|
|
/* signal Strength, in DBm */
|
|
|
|
c->strength.stat[0].uvalue = p->in_band_power * 1000;
|
2013-03-10 23:06:30 +08:00
|
|
|
|
2013-03-21 19:49:43 +08:00
|
|
|
/* Carrier to noise ratio, in DB */
|
2013-03-10 23:06:30 +08:00
|
|
|
c->cnr.stat[0].svalue = p->snr * 1000;
|
|
|
|
|
|
|
|
/* PER/BER requires demod lock */
|
2013-03-21 19:49:43 +08:00
|
|
|
if (!p->is_demod_locked)
|
2013-03-10 23:06:30 +08:00
|
|
|
return;
|
|
|
|
|
2013-03-10 06:26:28 +08:00
|
|
|
/* TS PER */
|
|
|
|
client->last_per = c->block_error.stat[0].uvalue;
|
|
|
|
c->block_error.stat[0].scale = FE_SCALE_COUNTER;
|
|
|
|
c->block_count.stat[0].scale = FE_SCALE_COUNTER;
|
2013-03-21 19:49:43 +08:00
|
|
|
c->block_error.stat[0].uvalue += p->ets_packets;
|
|
|
|
c->block_count.stat[0].uvalue += p->ets_packets + p->ts_packets;
|
2013-03-10 06:26:28 +08:00
|
|
|
|
2013-03-21 20:27:37 +08:00
|
|
|
/* ber */
|
2013-03-10 06:26:28 +08:00
|
|
|
c->post_bit_error.stat[0].scale = FE_SCALE_COUNTER;
|
|
|
|
c->post_bit_count.stat[0].scale = FE_SCALE_COUNTER;
|
2013-03-21 19:49:43 +08:00
|
|
|
c->post_bit_error.stat[0].uvalue += p->ber_error_count;
|
|
|
|
c->post_bit_count.stat[0].uvalue += p->ber_bit_count;
|
2013-03-10 06:26:28 +08:00
|
|
|
|
|
|
|
/* Legacy PER/BER */
|
2013-03-22 17:22:45 +08:00
|
|
|
tmp = p->ets_packets * 65535;
|
2013-08-14 16:24:39 +08:00
|
|
|
if (p->ts_packets + p->ets_packets)
|
|
|
|
do_div(tmp, p->ts_packets + p->ets_packets);
|
2013-03-22 17:22:45 +08:00
|
|
|
client->legacy_per = tmp;
|
2013-03-10 06:26:28 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void smsdvb_update_dvb_stats(struct smsdvb_client_t *client,
|
2013-03-21 20:06:03 +08:00
|
|
|
struct sms_stats *p)
|
2009-12-25 22:29:42 +08:00
|
|
|
{
|
2013-03-10 06:26:28 +08:00
|
|
|
struct dvb_frontend *fe = &client->frontend;
|
|
|
|
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
|
|
|
|
|
2013-03-10 20:04:44 +08:00
|
|
|
if (client->prt_dvb_stats)
|
|
|
|
client->prt_dvb_stats(client->debug_data, p);
|
2009-12-25 22:29:42 +08:00
|
|
|
|
2013-03-21 19:49:43 +08:00
|
|
|
client->fe_status = sms_to_status(p->is_demod_locked, p->is_rf_locked);
|
2013-03-10 06:26:28 +08:00
|
|
|
|
|
|
|
/* Update DVB modulation parameters */
|
2013-03-21 19:49:43 +08:00
|
|
|
c->frequency = p->frequency;
|
|
|
|
client->fe_status = sms_to_status(p->is_demod_locked, 0);
|
|
|
|
c->bandwidth_hz = sms_to_bw(p->bandwidth);
|
|
|
|
c->transmission_mode = sms_to_mode(p->transmission_mode);
|
|
|
|
c->guard_interval = sms_to_guard_interval(p->guard_interval);
|
|
|
|
c->code_rate_HP = sms_to_code_rate(p->code_rate);
|
|
|
|
c->code_rate_LP = sms_to_code_rate(p->lp_code_rate);
|
|
|
|
c->hierarchy = sms_to_hierarchy(p->hierarchy);
|
|
|
|
c->modulation = sms_to_modulation(p->constellation);
|
2013-03-10 06:26:28 +08:00
|
|
|
|
2013-03-08 08:58:47 +08:00
|
|
|
/* update reception data */
|
2013-03-21 19:49:43 +08:00
|
|
|
c->lna = p->is_external_lna_on ? 1 : 0;
|
2013-03-10 06:26:28 +08:00
|
|
|
|
2013-03-21 19:49:43 +08:00
|
|
|
/* Carrier to noise ratio, in DB */
|
2013-03-10 06:26:28 +08:00
|
|
|
c->cnr.stat[0].svalue = p->SNR * 1000;
|
|
|
|
|
2013-03-21 19:49:43 +08:00
|
|
|
/* signal Strength, in DBm */
|
|
|
|
c->strength.stat[0].uvalue = p->in_band_pwr * 1000;
|
2013-03-10 23:06:30 +08:00
|
|
|
|
|
|
|
/* PER/BER requires demod lock */
|
2013-03-21 19:49:43 +08:00
|
|
|
if (!p->is_demod_locked)
|
2013-03-10 23:06:30 +08:00
|
|
|
return;
|
2013-03-10 06:26:28 +08:00
|
|
|
|
|
|
|
/* TS PER */
|
|
|
|
client->last_per = c->block_error.stat[0].uvalue;
|
|
|
|
c->block_error.stat[0].scale = FE_SCALE_COUNTER;
|
|
|
|
c->block_count.stat[0].scale = FE_SCALE_COUNTER;
|
2013-03-21 19:49:43 +08:00
|
|
|
c->block_error.stat[0].uvalue += p->error_ts_packets;
|
|
|
|
c->block_count.stat[0].uvalue += p->total_ts_packets;
|
2013-03-10 06:26:28 +08:00
|
|
|
|
2013-03-21 20:27:37 +08:00
|
|
|
/* ber */
|
2013-03-10 06:26:28 +08:00
|
|
|
c->post_bit_error.stat[0].scale = FE_SCALE_COUNTER;
|
|
|
|
c->post_bit_count.stat[0].scale = FE_SCALE_COUNTER;
|
2013-03-21 19:49:43 +08:00
|
|
|
c->post_bit_error.stat[0].uvalue += p->ber_error_count;
|
|
|
|
c->post_bit_count.stat[0].uvalue += p->ber_bit_count;
|
2013-03-10 06:26:28 +08:00
|
|
|
|
|
|
|
/* Legacy PER/BER */
|
2013-03-21 20:27:37 +08:00
|
|
|
client->legacy_ber = p->ber;
|
2009-12-25 22:29:42 +08:00
|
|
|
};
|
|
|
|
|
2013-03-10 06:26:28 +08:00
|
|
|
static void smsdvb_update_isdbt_stats(struct smsdvb_client_t *client,
|
2013-03-21 20:06:03 +08:00
|
|
|
struct sms_isdbt_stats *p)
|
2009-12-25 22:29:42 +08:00
|
|
|
{
|
2013-03-10 06:26:28 +08:00
|
|
|
struct dvb_frontend *fe = &client->frontend;
|
|
|
|
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
|
2013-03-21 20:06:03 +08:00
|
|
|
struct sms_isdbt_layer_stats *lr;
|
2013-03-10 06:26:28 +08:00
|
|
|
int i, n_layers;
|
|
|
|
|
2013-03-10 20:04:44 +08:00
|
|
|
if (client->prt_isdb_stats)
|
|
|
|
client->prt_isdb_stats(client->debug_data, p);
|
2009-12-25 22:29:42 +08:00
|
|
|
|
2013-03-21 19:49:43 +08:00
|
|
|
client->fe_status = sms_to_status(p->is_demod_locked, p->is_rf_locked);
|
[media] siano: fix status report with old firmware and ISDB-T
This seems to be ever broken. That's the status report with
Firmware 2.1, before adding support for sms2270 is:
[22273.787218] smsdvb_onresponse: MSG_SMS_GET_STATISTICS_RES
[22273.792592] IsRfLocked = 1
[22273.792592] IsDemodLocked = 1
...
[22273.792598] TransmissionMode = -64
...
(all unshown fields are filled with zeros)
Of course, transmission mode being a negative number is wrong.
So, we need to take a deeper look on it.
With the debugfs patches applied, it is possible to see that, instead
of filling StatisticsType with 5, and FullSize with the size of the
payload (this is what happens with sms2270 and firmware 8.1),
those fields are also initialized with zero:
StatisticsType = 0 FullSize = 0
IsRfLocked = 1 IsDemodLocked = 1 IsExternalLNAOn = 0
SNR = 0 dB RSSI = 0 dBm InBandPwr = 0 dBm
CarrierOffset = 0 Bandwidth = 0 Frequency = 0 Hz
TransmissionMode = -64 ModemState = 0 GuardInterval = 0
SystemType = 0 PartialReception = 0 NumOfLayers = 0
SmsToHostTxErrors = 0
The data under "TransmissionMode" varies according with the signal,
and it is negative. It also matches the value for InBandPwr when
the tuner is on DVB-T (ok, signal doesn't lock, but the power level
should be about the same with the antena fixed, and measured at about
the same time).
So, there's a very high chance that, when StatisticsType is zero, the
signal strength is at the same position as Transmission Mode.
So, discard all other parameters, and provide only signal/rf lock and
signal strength if StatisticsType is 0, for ISDB-T.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-17 08:05:30 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Firmware 2.1 seems to report only lock status and
|
2013-03-21 19:49:43 +08:00
|
|
|
* signal strength. The signal strength indicator is at the
|
[media] siano: fix status report with old firmware and ISDB-T
This seems to be ever broken. That's the status report with
Firmware 2.1, before adding support for sms2270 is:
[22273.787218] smsdvb_onresponse: MSG_SMS_GET_STATISTICS_RES
[22273.792592] IsRfLocked = 1
[22273.792592] IsDemodLocked = 1
...
[22273.792598] TransmissionMode = -64
...
(all unshown fields are filled with zeros)
Of course, transmission mode being a negative number is wrong.
So, we need to take a deeper look on it.
With the debugfs patches applied, it is possible to see that, instead
of filling StatisticsType with 5, and FullSize with the size of the
payload (this is what happens with sms2270 and firmware 8.1),
those fields are also initialized with zero:
StatisticsType = 0 FullSize = 0
IsRfLocked = 1 IsDemodLocked = 1 IsExternalLNAOn = 0
SNR = 0 dB RSSI = 0 dBm InBandPwr = 0 dBm
CarrierOffset = 0 Bandwidth = 0 Frequency = 0 Hz
TransmissionMode = -64 ModemState = 0 GuardInterval = 0
SystemType = 0 PartialReception = 0 NumOfLayers = 0
SmsToHostTxErrors = 0
The data under "TransmissionMode" varies according with the signal,
and it is negative. It also matches the value for InBandPwr when
the tuner is on DVB-T (ok, signal doesn't lock, but the power level
should be about the same with the antena fixed, and measured at about
the same time).
So, there's a very high chance that, when StatisticsType is zero, the
signal strength is at the same position as Transmission Mode.
So, discard all other parameters, and provide only signal/rf lock and
signal strength if StatisticsType is 0, for ISDB-T.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-17 08:05:30 +08:00
|
|
|
* wrong field.
|
|
|
|
*/
|
2013-03-21 19:49:43 +08:00
|
|
|
if (p->statistics_type == 0) {
|
|
|
|
c->strength.stat[0].uvalue = ((s32)p->transmission_mode) * 1000;
|
[media] siano: fix status report with old firmware and ISDB-T
This seems to be ever broken. That's the status report with
Firmware 2.1, before adding support for sms2270 is:
[22273.787218] smsdvb_onresponse: MSG_SMS_GET_STATISTICS_RES
[22273.792592] IsRfLocked = 1
[22273.792592] IsDemodLocked = 1
...
[22273.792598] TransmissionMode = -64
...
(all unshown fields are filled with zeros)
Of course, transmission mode being a negative number is wrong.
So, we need to take a deeper look on it.
With the debugfs patches applied, it is possible to see that, instead
of filling StatisticsType with 5, and FullSize with the size of the
payload (this is what happens with sms2270 and firmware 8.1),
those fields are also initialized with zero:
StatisticsType = 0 FullSize = 0
IsRfLocked = 1 IsDemodLocked = 1 IsExternalLNAOn = 0
SNR = 0 dB RSSI = 0 dBm InBandPwr = 0 dBm
CarrierOffset = 0 Bandwidth = 0 Frequency = 0 Hz
TransmissionMode = -64 ModemState = 0 GuardInterval = 0
SystemType = 0 PartialReception = 0 NumOfLayers = 0
SmsToHostTxErrors = 0
The data under "TransmissionMode" varies according with the signal,
and it is negative. It also matches the value for InBandPwr when
the tuner is on DVB-T (ok, signal doesn't lock, but the power level
should be about the same with the antena fixed, and measured at about
the same time).
So, there's a very high chance that, when StatisticsType is zero, the
signal strength is at the same position as Transmission Mode.
So, discard all other parameters, and provide only signal/rf lock and
signal strength if StatisticsType is 0, for ISDB-T.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-17 08:05:30 +08:00
|
|
|
c->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-03-10 06:26:28 +08:00
|
|
|
/* Update ISDB-T transmission parameters */
|
2013-03-21 19:49:43 +08:00
|
|
|
c->frequency = p->frequency;
|
|
|
|
c->bandwidth_hz = sms_to_bw(p->bandwidth);
|
|
|
|
c->transmission_mode = sms_to_mode(p->transmission_mode);
|
|
|
|
c->guard_interval = sms_to_guard_interval(p->guard_interval);
|
|
|
|
c->isdbt_partial_reception = p->partial_reception ? 1 : 0;
|
|
|
|
n_layers = p->num_of_layers;
|
2013-03-10 06:26:28 +08:00
|
|
|
if (n_layers < 1)
|
|
|
|
n_layers = 1;
|
|
|
|
if (n_layers > 3)
|
|
|
|
n_layers = 3;
|
|
|
|
c->isdbt_layer_enabled = 0;
|
|
|
|
|
2013-03-08 08:58:47 +08:00
|
|
|
/* update reception data */
|
2013-03-21 19:49:43 +08:00
|
|
|
c->lna = p->is_external_lna_on ? 1 : 0;
|
2013-03-08 08:58:47 +08:00
|
|
|
|
2013-03-21 19:49:43 +08:00
|
|
|
/* Carrier to noise ratio, in DB */
|
2013-03-10 06:26:28 +08:00
|
|
|
c->cnr.stat[0].svalue = p->SNR * 1000;
|
|
|
|
|
2013-03-21 19:49:43 +08:00
|
|
|
/* signal Strength, in DBm */
|
|
|
|
c->strength.stat[0].uvalue = p->in_band_pwr * 1000;
|
2013-03-10 23:06:30 +08:00
|
|
|
|
|
|
|
/* PER/BER and per-layer stats require demod lock */
|
2013-03-21 19:49:43 +08:00
|
|
|
if (!p->is_demod_locked)
|
2013-03-10 23:06:30 +08:00
|
|
|
return;
|
2013-03-10 06:26:28 +08:00
|
|
|
|
|
|
|
client->last_per = c->block_error.stat[0].uvalue;
|
|
|
|
|
|
|
|
/* Clears global counters, as the code below will sum it again */
|
|
|
|
c->block_error.stat[0].uvalue = 0;
|
|
|
|
c->block_count.stat[0].uvalue = 0;
|
2013-03-11 00:38:41 +08:00
|
|
|
c->block_error.stat[0].scale = FE_SCALE_COUNTER;
|
|
|
|
c->block_count.stat[0].scale = FE_SCALE_COUNTER;
|
2013-03-10 06:26:28 +08:00
|
|
|
c->post_bit_error.stat[0].uvalue = 0;
|
|
|
|
c->post_bit_count.stat[0].uvalue = 0;
|
2013-03-11 00:38:41 +08:00
|
|
|
c->post_bit_error.stat[0].scale = FE_SCALE_COUNTER;
|
|
|
|
c->post_bit_count.stat[0].scale = FE_SCALE_COUNTER;
|
2013-03-10 06:26:28 +08:00
|
|
|
|
|
|
|
for (i = 0; i < n_layers; i++) {
|
2013-03-21 20:27:37 +08:00
|
|
|
lr = &p->layer_info[i];
|
2013-03-10 06:26:28 +08:00
|
|
|
|
|
|
|
/* Update per-layer transmission parameters */
|
2013-03-21 19:49:43 +08:00
|
|
|
if (lr->number_of_segments > 0 && lr->number_of_segments < 13) {
|
2013-03-10 06:26:28 +08:00
|
|
|
c->isdbt_layer_enabled |= 1 << i;
|
2013-03-21 19:49:43 +08:00
|
|
|
c->layer[i].segment_count = lr->number_of_segments;
|
2013-03-10 06:26:28 +08:00
|
|
|
} else {
|
|
|
|
continue;
|
|
|
|
}
|
2013-03-21 19:49:43 +08:00
|
|
|
c->layer[i].modulation = sms_to_modulation(lr->constellation);
|
2013-03-10 06:26:28 +08:00
|
|
|
|
|
|
|
/* TS PER */
|
2013-03-11 00:38:41 +08:00
|
|
|
c->block_error.stat[i + 1].scale = FE_SCALE_COUNTER;
|
|
|
|
c->block_count.stat[i + 1].scale = FE_SCALE_COUNTER;
|
2013-03-21 19:49:43 +08:00
|
|
|
c->block_error.stat[i + 1].uvalue += lr->error_ts_packets;
|
|
|
|
c->block_count.stat[i + 1].uvalue += lr->total_ts_packets;
|
2013-03-10 06:26:28 +08:00
|
|
|
|
|
|
|
/* Update global PER counter */
|
2013-03-21 19:49:43 +08:00
|
|
|
c->block_error.stat[0].uvalue += lr->error_ts_packets;
|
|
|
|
c->block_count.stat[0].uvalue += lr->total_ts_packets;
|
2013-03-10 06:26:28 +08:00
|
|
|
|
|
|
|
/* BER */
|
2013-03-11 00:38:41 +08:00
|
|
|
c->post_bit_error.stat[i + 1].scale = FE_SCALE_COUNTER;
|
|
|
|
c->post_bit_count.stat[i + 1].scale = FE_SCALE_COUNTER;
|
2013-03-21 19:49:43 +08:00
|
|
|
c->post_bit_error.stat[i + 1].uvalue += lr->ber_error_count;
|
|
|
|
c->post_bit_count.stat[i + 1].uvalue += lr->ber_bit_count;
|
2013-03-10 06:26:28 +08:00
|
|
|
|
|
|
|
/* Update global BER counter */
|
2013-03-21 19:49:43 +08:00
|
|
|
c->post_bit_error.stat[0].uvalue += lr->ber_error_count;
|
|
|
|
c->post_bit_count.stat[0].uvalue += lr->ber_bit_count;
|
2013-03-08 08:58:47 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-10 06:26:28 +08:00
|
|
|
static void smsdvb_update_isdbt_stats_ex(struct smsdvb_client_t *client,
|
2013-03-21 20:06:03 +08:00
|
|
|
struct sms_isdbt_stats_ex *p)
|
2013-03-08 08:58:47 +08:00
|
|
|
{
|
2013-03-10 06:26:28 +08:00
|
|
|
struct dvb_frontend *fe = &client->frontend;
|
|
|
|
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
|
2013-03-21 20:06:03 +08:00
|
|
|
struct sms_isdbt_layer_stats *lr;
|
2013-03-10 06:26:28 +08:00
|
|
|
int i, n_layers;
|
|
|
|
|
2013-03-10 20:04:44 +08:00
|
|
|
if (client->prt_isdb_stats_ex)
|
|
|
|
client->prt_isdb_stats_ex(client->debug_data, p);
|
2013-03-08 08:58:47 +08:00
|
|
|
|
2013-03-10 06:26:28 +08:00
|
|
|
/* Update ISDB-T transmission parameters */
|
2013-03-21 19:49:43 +08:00
|
|
|
c->frequency = p->frequency;
|
|
|
|
client->fe_status = sms_to_status(p->is_demod_locked, 0);
|
|
|
|
c->bandwidth_hz = sms_to_bw(p->bandwidth);
|
|
|
|
c->transmission_mode = sms_to_mode(p->transmission_mode);
|
|
|
|
c->guard_interval = sms_to_guard_interval(p->guard_interval);
|
|
|
|
c->isdbt_partial_reception = p->partial_reception ? 1 : 0;
|
|
|
|
n_layers = p->num_of_layers;
|
2013-03-10 06:26:28 +08:00
|
|
|
if (n_layers < 1)
|
|
|
|
n_layers = 1;
|
|
|
|
if (n_layers > 3)
|
|
|
|
n_layers = 3;
|
|
|
|
c->isdbt_layer_enabled = 0;
|
|
|
|
|
2013-03-08 08:58:47 +08:00
|
|
|
/* update reception data */
|
2013-03-21 19:49:43 +08:00
|
|
|
c->lna = p->is_external_lna_on ? 1 : 0;
|
2013-03-08 08:58:47 +08:00
|
|
|
|
2013-03-21 19:49:43 +08:00
|
|
|
/* Carrier to noise ratio, in DB */
|
2013-03-10 06:26:28 +08:00
|
|
|
c->cnr.stat[0].svalue = p->SNR * 1000;
|
|
|
|
|
2013-03-21 19:49:43 +08:00
|
|
|
/* signal Strength, in DBm */
|
|
|
|
c->strength.stat[0].uvalue = p->in_band_pwr * 1000;
|
2013-03-10 23:06:30 +08:00
|
|
|
|
|
|
|
/* PER/BER and per-layer stats require demod lock */
|
2013-03-21 19:49:43 +08:00
|
|
|
if (!p->is_demod_locked)
|
2013-03-10 23:06:30 +08:00
|
|
|
return;
|
2013-03-10 06:26:28 +08:00
|
|
|
|
|
|
|
client->last_per = c->block_error.stat[0].uvalue;
|
|
|
|
|
|
|
|
/* Clears global counters, as the code below will sum it again */
|
|
|
|
c->block_error.stat[0].uvalue = 0;
|
|
|
|
c->block_count.stat[0].uvalue = 0;
|
2013-03-11 00:38:41 +08:00
|
|
|
c->block_error.stat[0].scale = FE_SCALE_COUNTER;
|
|
|
|
c->block_count.stat[0].scale = FE_SCALE_COUNTER;
|
2013-03-10 06:26:28 +08:00
|
|
|
c->post_bit_error.stat[0].uvalue = 0;
|
|
|
|
c->post_bit_count.stat[0].uvalue = 0;
|
2013-03-11 00:38:41 +08:00
|
|
|
c->post_bit_error.stat[0].scale = FE_SCALE_COUNTER;
|
|
|
|
c->post_bit_count.stat[0].scale = FE_SCALE_COUNTER;
|
2013-03-10 06:26:28 +08:00
|
|
|
|
2013-03-11 00:38:41 +08:00
|
|
|
c->post_bit_error.len = n_layers + 1;
|
|
|
|
c->post_bit_count.len = n_layers + 1;
|
|
|
|
c->block_error.len = n_layers + 1;
|
|
|
|
c->block_count.len = n_layers + 1;
|
2013-03-10 06:26:28 +08:00
|
|
|
for (i = 0; i < n_layers; i++) {
|
2013-03-21 20:27:37 +08:00
|
|
|
lr = &p->layer_info[i];
|
2013-03-10 06:26:28 +08:00
|
|
|
|
|
|
|
/* Update per-layer transmission parameters */
|
2013-03-21 19:49:43 +08:00
|
|
|
if (lr->number_of_segments > 0 && lr->number_of_segments < 13) {
|
2013-03-10 06:26:28 +08:00
|
|
|
c->isdbt_layer_enabled |= 1 << i;
|
2013-03-21 19:49:43 +08:00
|
|
|
c->layer[i].segment_count = lr->number_of_segments;
|
2013-03-10 06:26:28 +08:00
|
|
|
} else {
|
|
|
|
continue;
|
|
|
|
}
|
2013-03-21 19:49:43 +08:00
|
|
|
c->layer[i].modulation = sms_to_modulation(lr->constellation);
|
2013-03-10 06:26:28 +08:00
|
|
|
|
|
|
|
/* TS PER */
|
2013-03-11 00:38:41 +08:00
|
|
|
c->block_error.stat[i + 1].scale = FE_SCALE_COUNTER;
|
|
|
|
c->block_count.stat[i + 1].scale = FE_SCALE_COUNTER;
|
2013-03-21 19:49:43 +08:00
|
|
|
c->block_error.stat[i + 1].uvalue += lr->error_ts_packets;
|
|
|
|
c->block_count.stat[i + 1].uvalue += lr->total_ts_packets;
|
2013-03-10 06:26:28 +08:00
|
|
|
|
|
|
|
/* Update global PER counter */
|
2013-03-21 19:49:43 +08:00
|
|
|
c->block_error.stat[0].uvalue += lr->error_ts_packets;
|
|
|
|
c->block_count.stat[0].uvalue += lr->total_ts_packets;
|
2013-03-10 06:26:28 +08:00
|
|
|
|
2013-03-21 20:27:37 +08:00
|
|
|
/* ber */
|
2013-03-11 00:38:41 +08:00
|
|
|
c->post_bit_error.stat[i + 1].scale = FE_SCALE_COUNTER;
|
|
|
|
c->post_bit_count.stat[i + 1].scale = FE_SCALE_COUNTER;
|
2013-03-21 19:49:43 +08:00
|
|
|
c->post_bit_error.stat[i + 1].uvalue += lr->ber_error_count;
|
|
|
|
c->post_bit_count.stat[i + 1].uvalue += lr->ber_bit_count;
|
2013-03-10 06:26:28 +08:00
|
|
|
|
2013-03-21 20:27:37 +08:00
|
|
|
/* Update global ber counter */
|
2013-03-21 19:49:43 +08:00
|
|
|
c->post_bit_error.stat[0].uvalue += lr->ber_error_count;
|
|
|
|
c->post_bit_count.stat[0].uvalue += lr->ber_bit_count;
|
2009-12-25 22:29:42 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-06-21 13:44:02 +08:00
|
|
|
static int smsdvb_onresponse(void *context, struct smscore_buffer_t *cb)
|
2008-05-20 05:56:13 +08:00
|
|
|
{
|
2008-06-16 04:52:24 +08:00
|
|
|
struct smsdvb_client_t *client = (struct smsdvb_client_t *) context;
|
2013-03-21 19:49:43 +08:00
|
|
|
struct sms_msg_hdr *phdr = (struct sms_msg_hdr *) (((u8 *) cb->p)
|
2009-05-12 23:28:46 +08:00
|
|
|
+ cb->offset);
|
2013-03-10 06:26:28 +08:00
|
|
|
void *p = phdr + 1;
|
|
|
|
struct dvb_frontend *fe = &client->frontend;
|
|
|
|
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
|
2009-05-12 23:28:46 +08:00
|
|
|
bool is_status_update = false;
|
2008-05-20 05:56:13 +08:00
|
|
|
|
2013-03-21 19:49:43 +08:00
|
|
|
switch (phdr->msg_type) {
|
2008-06-16 02:14:13 +08:00
|
|
|
case MSG_SMS_DVBT_BDA_DATA:
|
2013-03-15 18:22:08 +08:00
|
|
|
/*
|
|
|
|
* Only feed data to dvb demux if are there any feed listening
|
|
|
|
* to it and if the device has tuned
|
|
|
|
*/
|
|
|
|
if (client->feed_users && client->has_tuned)
|
|
|
|
dvb_dmx_swfilter(&client->demux, p,
|
2013-03-21 19:49:43 +08:00
|
|
|
cb->size - sizeof(struct sms_msg_hdr));
|
2008-06-16 02:14:13 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case MSG_SMS_RF_TUNE_RES:
|
2009-12-23 08:08:49 +08:00
|
|
|
case MSG_SMS_ISDBT_TUNE_RES:
|
2008-06-16 02:14:13 +08:00
|
|
|
complete(&client->tune_done);
|
|
|
|
break;
|
2008-05-20 05:56:13 +08:00
|
|
|
|
2009-05-12 23:28:46 +08:00
|
|
|
case MSG_SMS_SIGNAL_DETECTED_IND:
|
2013-03-10 06:26:28 +08:00
|
|
|
client->fe_status = FE_HAS_SIGNAL | FE_HAS_CARRIER |
|
|
|
|
FE_HAS_VITERBI | FE_HAS_SYNC |
|
|
|
|
FE_HAS_LOCK;
|
|
|
|
|
2009-05-12 23:28:46 +08:00
|
|
|
is_status_update = true;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MSG_SMS_NO_SIGNAL_IND:
|
2013-03-10 06:26:28 +08:00
|
|
|
client->fe_status = 0;
|
|
|
|
|
2009-05-12 23:28:46 +08:00
|
|
|
is_status_update = true;
|
|
|
|
break;
|
|
|
|
|
2013-03-10 06:26:28 +08:00
|
|
|
case MSG_SMS_TRANSMISSION_IND:
|
|
|
|
smsdvb_update_tx_params(client, p);
|
2009-05-12 23:28:46 +08:00
|
|
|
|
|
|
|
is_status_update = true;
|
|
|
|
break;
|
|
|
|
|
2013-03-10 06:26:28 +08:00
|
|
|
case MSG_SMS_HO_PER_SLICES_IND:
|
|
|
|
smsdvb_update_per_slices(client, p);
|
2009-05-12 23:28:46 +08:00
|
|
|
|
|
|
|
is_status_update = true;
|
|
|
|
break;
|
2009-12-25 22:29:42 +08:00
|
|
|
|
2013-03-10 06:26:28 +08:00
|
|
|
case MSG_SMS_GET_STATISTICS_RES:
|
2009-12-25 22:29:42 +08:00
|
|
|
switch (smscore_get_device_mode(client->coredev)) {
|
|
|
|
case DEVICE_MODE_ISDBT:
|
|
|
|
case DEVICE_MODE_ISDBT_BDA:
|
2013-03-10 06:26:28 +08:00
|
|
|
smsdvb_update_isdbt_stats(client, p);
|
2009-12-25 22:29:42 +08:00
|
|
|
break;
|
|
|
|
default:
|
2013-03-21 19:49:43 +08:00
|
|
|
/* Skip sms_msg_statistics_info:request_result field */
|
2013-03-10 10:01:48 +08:00
|
|
|
smsdvb_update_dvb_stats(client, p + sizeof(u32));
|
2009-12-23 21:07:16 +08:00
|
|
|
}
|
|
|
|
|
2013-03-10 06:26:28 +08:00
|
|
|
is_status_update = true;
|
2009-12-23 21:07:16 +08:00
|
|
|
break;
|
2013-03-08 08:58:47 +08:00
|
|
|
|
2013-03-10 06:26:28 +08:00
|
|
|
/* Only for ISDB-T */
|
|
|
|
case MSG_SMS_GET_STATISTICS_EX_RES:
|
2013-03-21 19:49:43 +08:00
|
|
|
/* Skip sms_msg_statistics_info:request_result field? */
|
2013-03-10 10:01:48 +08:00
|
|
|
smsdvb_update_isdbt_stats_ex(client, p + sizeof(u32));
|
2013-03-08 08:58:47 +08:00
|
|
|
is_status_update = true;
|
|
|
|
break;
|
2009-12-23 21:07:16 +08:00
|
|
|
default:
|
2015-02-22 22:49:28 +08:00
|
|
|
pr_debug("message not handled\n");
|
2009-05-12 23:28:46 +08:00
|
|
|
}
|
2008-05-20 05:56:13 +08:00
|
|
|
smscore_putbuffer(client->coredev, cb);
|
|
|
|
|
2009-05-12 23:28:46 +08:00
|
|
|
if (is_status_update) {
|
2013-03-11 00:38:41 +08:00
|
|
|
if (client->fe_status & FE_HAS_LOCK) {
|
2009-05-12 23:28:46 +08:00
|
|
|
sms_board_dvb3_event(client, DVB3_EVENT_FE_LOCK);
|
2013-03-10 06:26:28 +08:00
|
|
|
if (client->last_per == c->block_error.stat[0].uvalue)
|
2009-05-12 23:28:46 +08:00
|
|
|
sms_board_dvb3_event(client, DVB3_EVENT_UNC_OK);
|
|
|
|
else
|
2013-03-10 06:26:28 +08:00
|
|
|
sms_board_dvb3_event(client, DVB3_EVENT_UNC_ERR);
|
2013-03-15 18:22:08 +08:00
|
|
|
client->has_tuned = true;
|
2009-05-12 23:28:46 +08:00
|
|
|
} else {
|
2013-03-10 06:26:28 +08:00
|
|
|
smsdvb_stats_not_ready(fe);
|
2013-03-15 18:22:08 +08:00
|
|
|
client->has_tuned = false;
|
2009-05-12 23:28:46 +08:00
|
|
|
sms_board_dvb3_event(client, DVB3_EVENT_FE_UNLOCK);
|
|
|
|
}
|
2013-03-08 03:32:33 +08:00
|
|
|
complete(&client->stats_done);
|
2009-05-12 23:28:46 +08:00
|
|
|
}
|
|
|
|
|
2008-05-20 05:56:13 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-01-07 19:03:03 +08:00
|
|
|
static void smsdvb_media_device_unregister(struct smsdvb_client_t *client)
|
|
|
|
{
|
|
|
|
struct smscore_device_t *coredev = client->coredev;
|
|
|
|
|
|
|
|
#ifdef CONFIG_MEDIA_CONTROLLER_DVB
|
|
|
|
if (!coredev->media_dev)
|
|
|
|
return;
|
|
|
|
media_device_unregister(coredev->media_dev);
|
|
|
|
kfree(coredev->media_dev);
|
|
|
|
coredev->media_dev = NULL;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2008-06-21 13:44:02 +08:00
|
|
|
static void smsdvb_unregister_client(struct smsdvb_client_t *client)
|
2008-05-20 05:56:13 +08:00
|
|
|
{
|
2008-06-16 02:52:43 +08:00
|
|
|
/* must be called under clientslock */
|
2008-05-20 05:56:13 +08:00
|
|
|
|
|
|
|
list_del(&client->entry);
|
|
|
|
|
2013-03-10 20:04:44 +08:00
|
|
|
smsdvb_debugfs_release(client);
|
2008-05-20 05:56:13 +08:00
|
|
|
smscore_unregister_client(client->smsclient);
|
|
|
|
dvb_unregister_frontend(&client->frontend);
|
|
|
|
dvb_dmxdev_release(&client->dmxdev);
|
|
|
|
dvb_dmx_release(&client->demux);
|
2015-01-07 19:03:03 +08:00
|
|
|
smsdvb_media_device_unregister(client);
|
2008-05-20 05:56:13 +08:00
|
|
|
dvb_unregister_adapter(&client->adapter);
|
|
|
|
kfree(client);
|
|
|
|
}
|
|
|
|
|
2008-06-21 13:44:02 +08:00
|
|
|
static void smsdvb_onremove(void *context)
|
2008-05-20 05:56:13 +08:00
|
|
|
{
|
|
|
|
kmutex_lock(&g_smsdvb_clientslock);
|
|
|
|
|
2008-06-16 04:52:24 +08:00
|
|
|
smsdvb_unregister_client((struct smsdvb_client_t *) context);
|
2008-05-20 05:56:13 +08:00
|
|
|
|
|
|
|
kmutex_unlock(&g_smsdvb_clientslock);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int smsdvb_start_feed(struct dvb_demux_feed *feed)
|
|
|
|
{
|
2008-06-16 04:52:24 +08:00
|
|
|
struct smsdvb_client_t *client =
|
|
|
|
container_of(feed->demux, struct smsdvb_client_t, demux);
|
2013-03-21 20:27:37 +08:00
|
|
|
struct sms_msg_data pid_msg;
|
2008-05-20 05:56:13 +08:00
|
|
|
|
2015-02-22 22:33:37 +08:00
|
|
|
pr_debug("add pid %d(%x)\n",
|
2008-06-19 12:15:46 +08:00
|
|
|
feed->pid, feed->pid);
|
2008-05-20 05:56:13 +08:00
|
|
|
|
2013-03-15 18:22:08 +08:00
|
|
|
client->feed_users++;
|
|
|
|
|
2013-03-21 20:27:37 +08:00
|
|
|
pid_msg.x_msg_header.msg_src_id = DVBT_BDA_CONTROL_MSG_ID;
|
|
|
|
pid_msg.x_msg_header.msg_dst_id = HIF_TASK;
|
|
|
|
pid_msg.x_msg_header.msg_flags = 0;
|
|
|
|
pid_msg.x_msg_header.msg_type = MSG_SMS_ADD_PID_FILTER_REQ;
|
|
|
|
pid_msg.x_msg_header.msg_length = sizeof(pid_msg);
|
|
|
|
pid_msg.msg_data[0] = feed->pid;
|
2008-05-20 05:56:13 +08:00
|
|
|
|
2008-06-16 02:14:13 +08:00
|
|
|
return smsclient_sendrequest(client->smsclient,
|
2013-03-21 20:27:37 +08:00
|
|
|
&pid_msg, sizeof(pid_msg));
|
2008-05-20 05:56:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int smsdvb_stop_feed(struct dvb_demux_feed *feed)
|
|
|
|
{
|
2008-06-16 04:52:24 +08:00
|
|
|
struct smsdvb_client_t *client =
|
|
|
|
container_of(feed->demux, struct smsdvb_client_t, demux);
|
2013-03-21 20:27:37 +08:00
|
|
|
struct sms_msg_data pid_msg;
|
2008-05-20 05:56:13 +08:00
|
|
|
|
2015-02-22 22:33:37 +08:00
|
|
|
pr_debug("remove pid %d(%x)\n",
|
2008-06-19 12:15:46 +08:00
|
|
|
feed->pid, feed->pid);
|
2008-05-20 05:56:13 +08:00
|
|
|
|
2013-03-15 18:22:08 +08:00
|
|
|
client->feed_users--;
|
|
|
|
|
2013-03-21 20:27:37 +08:00
|
|
|
pid_msg.x_msg_header.msg_src_id = DVBT_BDA_CONTROL_MSG_ID;
|
|
|
|
pid_msg.x_msg_header.msg_dst_id = HIF_TASK;
|
|
|
|
pid_msg.x_msg_header.msg_flags = 0;
|
|
|
|
pid_msg.x_msg_header.msg_type = MSG_SMS_REMOVE_PID_FILTER_REQ;
|
|
|
|
pid_msg.x_msg_header.msg_length = sizeof(pid_msg);
|
|
|
|
pid_msg.msg_data[0] = feed->pid;
|
2008-05-20 05:56:13 +08:00
|
|
|
|
2008-06-16 02:14:13 +08:00
|
|
|
return smsclient_sendrequest(client->smsclient,
|
2013-03-21 20:27:37 +08:00
|
|
|
&pid_msg, sizeof(pid_msg));
|
2008-05-20 05:56:13 +08:00
|
|
|
}
|
|
|
|
|
2008-06-16 04:52:24 +08:00
|
|
|
static int smsdvb_sendrequest_and_wait(struct smsdvb_client_t *client,
|
2008-05-06 14:11:51 +08:00
|
|
|
void *buffer, size_t size,
|
|
|
|
struct completion *completion)
|
2008-05-20 05:56:13 +08:00
|
|
|
{
|
2009-05-12 22:37:09 +08:00
|
|
|
int rc;
|
|
|
|
|
|
|
|
rc = smsclient_sendrequest(client->smsclient, buffer, size);
|
2008-05-20 05:56:13 +08:00
|
|
|
if (rc < 0)
|
|
|
|
return rc;
|
|
|
|
|
2008-06-16 02:14:13 +08:00
|
|
|
return wait_for_completion_timeout(completion,
|
|
|
|
msecs_to_jiffies(2000)) ?
|
|
|
|
0 : -ETIME;
|
2008-05-20 05:56:13 +08:00
|
|
|
}
|
|
|
|
|
2009-12-23 21:07:16 +08:00
|
|
|
static int smsdvb_send_statistics_request(struct smsdvb_client_t *client)
|
|
|
|
{
|
|
|
|
int rc;
|
2013-03-21 20:27:37 +08:00
|
|
|
struct sms_msg_hdr msg;
|
2013-03-08 08:58:47 +08:00
|
|
|
|
2013-03-10 21:51:25 +08:00
|
|
|
/* Don't request stats too fast */
|
|
|
|
if (client->get_stats_jiffies &&
|
|
|
|
(!time_after(jiffies, client->get_stats_jiffies)))
|
|
|
|
return 0;
|
|
|
|
client->get_stats_jiffies = jiffies + msecs_to_jiffies(100);
|
2013-03-08 08:58:47 +08:00
|
|
|
|
2013-03-21 20:27:37 +08:00
|
|
|
msg.msg_src_id = DVBT_BDA_CONTROL_MSG_ID;
|
|
|
|
msg.msg_dst_id = HIF_TASK;
|
|
|
|
msg.msg_flags = 0;
|
|
|
|
msg.msg_length = sizeof(msg);
|
2013-03-08 08:58:47 +08:00
|
|
|
|
2013-03-10 06:26:28 +08:00
|
|
|
switch (smscore_get_device_mode(client->coredev)) {
|
|
|
|
case DEVICE_MODE_ISDBT:
|
|
|
|
case DEVICE_MODE_ISDBT_BDA:
|
|
|
|
/*
|
|
|
|
* Check for firmware version, to avoid breaking for old cards
|
|
|
|
*/
|
|
|
|
if (client->coredev->fw_version >= 0x800)
|
2013-03-21 20:27:37 +08:00
|
|
|
msg.msg_type = MSG_SMS_GET_STATISTICS_EX_REQ;
|
2013-03-10 06:26:28 +08:00
|
|
|
else
|
2013-03-21 20:27:37 +08:00
|
|
|
msg.msg_type = MSG_SMS_GET_STATISTICS_REQ;
|
2013-03-10 06:26:28 +08:00
|
|
|
break;
|
|
|
|
default:
|
2013-03-21 20:27:37 +08:00
|
|
|
msg.msg_type = MSG_SMS_GET_STATISTICS_REQ;
|
2013-03-10 06:26:28 +08:00
|
|
|
}
|
2013-03-08 08:58:47 +08:00
|
|
|
|
2013-03-21 20:27:37 +08:00
|
|
|
rc = smsdvb_sendrequest_and_wait(client, &msg, sizeof(msg),
|
2013-03-08 03:32:33 +08:00
|
|
|
&client->stats_done);
|
2009-12-23 21:07:16 +08:00
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2009-07-13 10:30:14 +08:00
|
|
|
static inline int led_feedback(struct smsdvb_client_t *client)
|
|
|
|
{
|
2013-03-10 06:26:28 +08:00
|
|
|
if (!(client->fe_status & FE_HAS_LOCK))
|
2009-07-13 10:30:14 +08:00
|
|
|
return sms_board_led_feedback(client->coredev, SMS_LED_OFF);
|
2013-03-10 06:26:28 +08:00
|
|
|
|
|
|
|
return sms_board_led_feedback(client->coredev,
|
|
|
|
(client->legacy_ber == 0) ?
|
|
|
|
SMS_LED_HI : SMS_LED_LO);
|
2009-07-13 10:30:14 +08:00
|
|
|
}
|
|
|
|
|
2008-05-20 05:56:13 +08:00
|
|
|
static int smsdvb_read_status(struct dvb_frontend *fe, fe_status_t *stat)
|
|
|
|
{
|
2009-12-23 21:07:16 +08:00
|
|
|
int rc;
|
2009-05-12 23:28:46 +08:00
|
|
|
struct smsdvb_client_t *client;
|
|
|
|
client = container_of(fe, struct smsdvb_client_t, frontend);
|
2008-05-20 05:56:13 +08:00
|
|
|
|
2009-12-23 21:07:16 +08:00
|
|
|
rc = smsdvb_send_statistics_request(client);
|
|
|
|
|
2009-05-12 23:28:46 +08:00
|
|
|
*stat = client->fe_status;
|
2008-05-20 05:56:13 +08:00
|
|
|
|
2009-07-13 10:30:14 +08:00
|
|
|
led_feedback(client);
|
|
|
|
|
2009-12-23 21:07:16 +08:00
|
|
|
return rc;
|
2008-05-20 05:56:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int smsdvb_read_ber(struct dvb_frontend *fe, u32 *ber)
|
|
|
|
{
|
2009-12-23 21:07:16 +08:00
|
|
|
int rc;
|
2009-05-12 23:28:46 +08:00
|
|
|
struct smsdvb_client_t *client;
|
2013-03-10 06:26:28 +08:00
|
|
|
|
2009-05-12 23:28:46 +08:00
|
|
|
client = container_of(fe, struct smsdvb_client_t, frontend);
|
2008-05-20 05:56:13 +08:00
|
|
|
|
2009-12-23 21:07:16 +08:00
|
|
|
rc = smsdvb_send_statistics_request(client);
|
|
|
|
|
2013-03-10 06:26:28 +08:00
|
|
|
*ber = client->legacy_ber;
|
2008-05-20 05:56:13 +08:00
|
|
|
|
2009-07-13 10:30:14 +08:00
|
|
|
led_feedback(client);
|
|
|
|
|
2009-12-23 21:07:16 +08:00
|
|
|
return rc;
|
2008-05-20 05:56:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int smsdvb_read_signal_strength(struct dvb_frontend *fe, u16 *strength)
|
|
|
|
{
|
2013-03-10 06:26:28 +08:00
|
|
|
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
|
2009-12-23 21:07:16 +08:00
|
|
|
int rc;
|
2013-03-10 06:26:28 +08:00
|
|
|
s32 power = (s32) c->strength.stat[0].uvalue;
|
2009-05-12 23:28:46 +08:00
|
|
|
struct smsdvb_client_t *client;
|
2013-03-10 06:26:28 +08:00
|
|
|
|
2009-05-12 23:28:46 +08:00
|
|
|
client = container_of(fe, struct smsdvb_client_t, frontend);
|
2008-05-20 05:56:13 +08:00
|
|
|
|
2009-12-23 21:07:16 +08:00
|
|
|
rc = smsdvb_send_statistics_request(client);
|
|
|
|
|
2013-03-10 06:26:28 +08:00
|
|
|
if (power < -95)
|
2009-05-12 23:28:46 +08:00
|
|
|
*strength = 0;
|
2013-03-10 06:26:28 +08:00
|
|
|
else if (power > -29)
|
|
|
|
*strength = 65535;
|
2009-05-12 23:28:46 +08:00
|
|
|
else
|
2013-03-10 06:26:28 +08:00
|
|
|
*strength = (power + 95) * 65535 / 66;
|
2008-05-20 05:56:13 +08:00
|
|
|
|
2009-07-13 10:30:14 +08:00
|
|
|
led_feedback(client);
|
|
|
|
|
2009-12-23 21:07:16 +08:00
|
|
|
return rc;
|
2008-05-20 05:56:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int smsdvb_read_snr(struct dvb_frontend *fe, u16 *snr)
|
|
|
|
{
|
2013-03-10 06:26:28 +08:00
|
|
|
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
|
2009-12-23 21:07:16 +08:00
|
|
|
int rc;
|
2009-05-12 23:28:46 +08:00
|
|
|
struct smsdvb_client_t *client;
|
2013-03-10 06:26:28 +08:00
|
|
|
|
2009-05-12 23:28:46 +08:00
|
|
|
client = container_of(fe, struct smsdvb_client_t, frontend);
|
2008-05-20 05:56:13 +08:00
|
|
|
|
2009-12-23 21:07:16 +08:00
|
|
|
rc = smsdvb_send_statistics_request(client);
|
|
|
|
|
2013-03-10 06:26:28 +08:00
|
|
|
/* Preferred scale for SNR with legacy API: 0.1 dB */
|
2013-03-22 17:22:45 +08:00
|
|
|
*snr = ((u32)c->cnr.stat[0].svalue) / 100;
|
2008-05-20 05:56:13 +08:00
|
|
|
|
2009-07-13 10:30:14 +08:00
|
|
|
led_feedback(client);
|
|
|
|
|
2009-12-23 21:07:16 +08:00
|
|
|
return rc;
|
2008-05-20 05:56:13 +08:00
|
|
|
}
|
|
|
|
|
2008-11-23 01:56:37 +08:00
|
|
|
static int smsdvb_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks)
|
|
|
|
{
|
2009-12-23 21:07:16 +08:00
|
|
|
int rc;
|
2013-03-10 06:26:28 +08:00
|
|
|
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
|
2009-05-12 23:28:46 +08:00
|
|
|
struct smsdvb_client_t *client;
|
2013-03-10 06:26:28 +08:00
|
|
|
|
2009-05-12 23:28:46 +08:00
|
|
|
client = container_of(fe, struct smsdvb_client_t, frontend);
|
2008-11-23 01:56:37 +08:00
|
|
|
|
2009-12-23 21:07:16 +08:00
|
|
|
rc = smsdvb_send_statistics_request(client);
|
|
|
|
|
2013-03-10 06:26:28 +08:00
|
|
|
*ucblocks = c->block_error.stat[0].uvalue;
|
2008-11-23 01:56:37 +08:00
|
|
|
|
2009-07-13 10:30:14 +08:00
|
|
|
led_feedback(client);
|
|
|
|
|
2009-12-23 21:07:16 +08:00
|
|
|
return rc;
|
2008-11-23 01:56:37 +08:00
|
|
|
}
|
|
|
|
|
2008-06-16 02:14:13 +08:00
|
|
|
static int smsdvb_get_tune_settings(struct dvb_frontend *fe,
|
|
|
|
struct dvb_frontend_tune_settings *tune)
|
2008-05-20 05:56:13 +08:00
|
|
|
{
|
2015-02-22 22:33:37 +08:00
|
|
|
pr_debug("\n");
|
2008-05-20 05:56:13 +08:00
|
|
|
|
|
|
|
tune->min_delay_ms = 400;
|
|
|
|
tune->step_size = 250000;
|
|
|
|
tune->max_drift = 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-12-27 03:31:29 +08:00
|
|
|
static int smsdvb_dvbt_set_frontend(struct dvb_frontend *fe)
|
2008-05-20 05:56:13 +08:00
|
|
|
{
|
2009-12-23 22:28:46 +08:00
|
|
|
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
|
2008-06-16 04:52:24 +08:00
|
|
|
struct smsdvb_client_t *client =
|
|
|
|
container_of(fe, struct smsdvb_client_t, frontend);
|
2008-05-20 05:56:13 +08:00
|
|
|
|
2008-06-16 04:52:24 +08:00
|
|
|
struct {
|
2013-03-21 20:27:37 +08:00
|
|
|
struct sms_msg_hdr msg;
|
2008-06-16 02:14:13 +08:00
|
|
|
u32 Data[3];
|
2013-03-21 20:27:37 +08:00
|
|
|
} msg;
|
2008-05-20 05:56:13 +08:00
|
|
|
|
2009-07-13 10:30:14 +08:00
|
|
|
int ret;
|
|
|
|
|
2013-03-10 06:26:28 +08:00
|
|
|
client->fe_status = 0;
|
2009-05-12 23:28:46 +08:00
|
|
|
client->event_fe_state = -1;
|
|
|
|
client->event_unc_state = -1;
|
2009-12-25 18:17:03 +08:00
|
|
|
fe->dtv_property_cache.delivery_system = SYS_DVBT;
|
2009-05-12 23:28:46 +08:00
|
|
|
|
2013-03-21 20:27:37 +08:00
|
|
|
msg.msg.msg_src_id = DVBT_BDA_CONTROL_MSG_ID;
|
|
|
|
msg.msg.msg_dst_id = HIF_TASK;
|
|
|
|
msg.msg.msg_flags = 0;
|
|
|
|
msg.msg.msg_type = MSG_SMS_RF_TUNE_REQ;
|
|
|
|
msg.msg.msg_length = sizeof(msg);
|
|
|
|
msg.Data[0] = c->frequency;
|
|
|
|
msg.Data[2] = 12000000;
|
2008-05-20 05:56:13 +08:00
|
|
|
|
2015-02-22 22:49:28 +08:00
|
|
|
pr_debug("%s: freq %d band %d\n", __func__, c->frequency,
|
2009-12-23 22:28:46 +08:00
|
|
|
c->bandwidth_hz);
|
2008-05-20 05:56:13 +08:00
|
|
|
|
2009-12-25 18:29:06 +08:00
|
|
|
switch (c->bandwidth_hz / 1000000) {
|
2009-12-23 22:28:46 +08:00
|
|
|
case 8:
|
2013-03-21 20:27:37 +08:00
|
|
|
msg.Data[1] = BW_8_MHZ;
|
2009-12-23 22:28:46 +08:00
|
|
|
break;
|
|
|
|
case 7:
|
2013-03-21 20:27:37 +08:00
|
|
|
msg.Data[1] = BW_7_MHZ;
|
2009-12-23 22:28:46 +08:00
|
|
|
break;
|
|
|
|
case 6:
|
2013-03-21 20:27:37 +08:00
|
|
|
msg.Data[1] = BW_6_MHZ;
|
2009-12-23 22:28:46 +08:00
|
|
|
break;
|
|
|
|
case 0:
|
|
|
|
return -EOPNOTSUPP;
|
|
|
|
default:
|
|
|
|
return -EINVAL;
|
2008-05-20 05:56:13 +08:00
|
|
|
}
|
2009-07-13 10:30:14 +08:00
|
|
|
/* Disable LNA, if any. An error is returned if no LNA is present */
|
|
|
|
ret = sms_board_lna_control(client->coredev, 0);
|
|
|
|
if (ret == 0) {
|
|
|
|
fe_status_t status;
|
|
|
|
|
|
|
|
/* tune with LNA off at first */
|
2013-03-21 20:27:37 +08:00
|
|
|
ret = smsdvb_sendrequest_and_wait(client, &msg, sizeof(msg),
|
2009-07-13 10:30:14 +08:00
|
|
|
&client->tune_done);
|
|
|
|
|
|
|
|
smsdvb_read_status(fe, &status);
|
|
|
|
|
|
|
|
if (status & FE_HAS_LOCK)
|
|
|
|
return ret;
|
|
|
|
|
2011-03-31 09:57:33 +08:00
|
|
|
/* previous tune didn't lock - enable LNA and tune again */
|
2009-07-13 10:30:14 +08:00
|
|
|
sms_board_lna_control(client->coredev, 1);
|
|
|
|
}
|
2008-05-20 05:56:13 +08:00
|
|
|
|
2013-03-21 20:27:37 +08:00
|
|
|
return smsdvb_sendrequest_and_wait(client, &msg, sizeof(msg),
|
2008-06-16 02:14:13 +08:00
|
|
|
&client->tune_done);
|
2008-05-20 05:56:13 +08:00
|
|
|
}
|
|
|
|
|
2011-12-27 03:31:29 +08:00
|
|
|
static int smsdvb_isdbt_set_frontend(struct dvb_frontend *fe)
|
2009-12-23 08:08:49 +08:00
|
|
|
{
|
2009-12-23 22:28:46 +08:00
|
|
|
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
|
2009-12-23 08:08:49 +08:00
|
|
|
struct smsdvb_client_t *client =
|
|
|
|
container_of(fe, struct smsdvb_client_t, frontend);
|
2013-03-08 03:34:06 +08:00
|
|
|
int board_id = smscore_get_board_id(client->coredev);
|
|
|
|
struct sms_board *board = sms_get_board(board_id);
|
|
|
|
enum sms_device_type_st type = board->type;
|
2013-03-08 03:34:53 +08:00
|
|
|
int ret;
|
2013-03-10 20:04:44 +08:00
|
|
|
|
2009-12-23 08:08:49 +08:00
|
|
|
struct {
|
2013-03-21 20:27:37 +08:00
|
|
|
struct sms_msg_hdr msg;
|
2009-12-23 08:08:49 +08:00
|
|
|
u32 Data[4];
|
2013-03-21 20:27:37 +08:00
|
|
|
} msg;
|
2009-12-23 08:08:49 +08:00
|
|
|
|
2009-12-25 18:17:03 +08:00
|
|
|
fe->dtv_property_cache.delivery_system = SYS_ISDBT;
|
|
|
|
|
2013-03-21 20:27:37 +08:00
|
|
|
msg.msg.msg_src_id = DVBT_BDA_CONTROL_MSG_ID;
|
|
|
|
msg.msg.msg_dst_id = HIF_TASK;
|
|
|
|
msg.msg.msg_flags = 0;
|
|
|
|
msg.msg.msg_type = MSG_SMS_ISDBT_TUNE_REQ;
|
|
|
|
msg.msg.msg_length = sizeof(msg);
|
2009-12-23 08:08:49 +08:00
|
|
|
|
2009-12-23 22:28:46 +08:00
|
|
|
if (c->isdbt_sb_segment_idx == -1)
|
|
|
|
c->isdbt_sb_segment_idx = 0;
|
2009-12-23 08:08:49 +08:00
|
|
|
|
2013-03-08 03:34:06 +08:00
|
|
|
if (!c->isdbt_layer_enabled)
|
|
|
|
c->isdbt_layer_enabled = 7;
|
2009-12-23 08:08:49 +08:00
|
|
|
|
2013-03-21 20:27:37 +08:00
|
|
|
msg.Data[0] = c->frequency;
|
|
|
|
msg.Data[1] = BW_ISDBT_1SEG;
|
|
|
|
msg.Data[2] = 12000000;
|
|
|
|
msg.Data[3] = c->isdbt_sb_segment_idx;
|
2009-12-23 22:28:46 +08:00
|
|
|
|
2013-03-08 03:34:06 +08:00
|
|
|
if (c->isdbt_partial_reception) {
|
|
|
|
if ((type == SMS_PELE || type == SMS_RIO) &&
|
|
|
|
c->isdbt_sb_segment_count > 3)
|
2013-03-21 20:27:37 +08:00
|
|
|
msg.Data[1] = BW_ISDBT_13SEG;
|
2013-03-08 03:34:06 +08:00
|
|
|
else if (c->isdbt_sb_segment_count > 1)
|
2013-03-21 20:27:37 +08:00
|
|
|
msg.Data[1] = BW_ISDBT_3SEG;
|
2013-03-08 03:34:06 +08:00
|
|
|
} else if (type == SMS_PELE || type == SMS_RIO)
|
2013-03-21 20:27:37 +08:00
|
|
|
msg.Data[1] = BW_ISDBT_13SEG;
|
2013-03-08 03:34:06 +08:00
|
|
|
|
|
|
|
c->bandwidth_hz = 6000000;
|
|
|
|
|
2015-02-22 22:49:28 +08:00
|
|
|
pr_debug("freq %d segwidth %d segindex %d\n",
|
2009-12-23 22:28:46 +08:00
|
|
|
c->frequency, c->isdbt_sb_segment_count,
|
|
|
|
c->isdbt_sb_segment_idx);
|
|
|
|
|
2013-03-08 03:34:53 +08:00
|
|
|
/* Disable LNA, if any. An error is returned if no LNA is present */
|
|
|
|
ret = sms_board_lna_control(client->coredev, 0);
|
|
|
|
if (ret == 0) {
|
|
|
|
fe_status_t status;
|
|
|
|
|
|
|
|
/* tune with LNA off at first */
|
2013-03-21 20:27:37 +08:00
|
|
|
ret = smsdvb_sendrequest_and_wait(client, &msg, sizeof(msg),
|
2013-03-08 03:34:53 +08:00
|
|
|
&client->tune_done);
|
|
|
|
|
|
|
|
smsdvb_read_status(fe, &status);
|
|
|
|
|
|
|
|
if (status & FE_HAS_LOCK)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
/* previous tune didn't lock - enable LNA and tune again */
|
|
|
|
sms_board_lna_control(client->coredev, 1);
|
|
|
|
}
|
2013-03-21 20:27:37 +08:00
|
|
|
return smsdvb_sendrequest_and_wait(client, &msg, sizeof(msg),
|
2009-12-23 08:08:49 +08:00
|
|
|
&client->tune_done);
|
|
|
|
}
|
|
|
|
|
2011-12-27 03:31:29 +08:00
|
|
|
static int smsdvb_set_frontend(struct dvb_frontend *fe)
|
2009-12-23 08:08:49 +08:00
|
|
|
{
|
2013-03-10 23:06:30 +08:00
|
|
|
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
|
2009-12-23 08:08:49 +08:00
|
|
|
struct smsdvb_client_t *client =
|
|
|
|
container_of(fe, struct smsdvb_client_t, frontend);
|
|
|
|
struct smscore_device_t *coredev = client->coredev;
|
|
|
|
|
2013-03-10 06:26:28 +08:00
|
|
|
smsdvb_stats_not_ready(fe);
|
2013-03-10 23:06:30 +08:00
|
|
|
c->strength.stat[0].uvalue = 0;
|
|
|
|
c->cnr.stat[0].uvalue = 0;
|
2013-03-10 06:26:28 +08:00
|
|
|
|
2013-03-15 18:22:08 +08:00
|
|
|
client->has_tuned = false;
|
|
|
|
|
2009-12-23 08:08:49 +08:00
|
|
|
switch (smscore_get_device_mode(coredev)) {
|
|
|
|
case DEVICE_MODE_DVBT:
|
|
|
|
case DEVICE_MODE_DVBT_BDA:
|
2011-12-27 03:31:29 +08:00
|
|
|
return smsdvb_dvbt_set_frontend(fe);
|
2009-12-23 08:08:49 +08:00
|
|
|
case DEVICE_MODE_ISDBT:
|
|
|
|
case DEVICE_MODE_ISDBT_BDA:
|
2011-12-27 03:31:29 +08:00
|
|
|
return smsdvb_isdbt_set_frontend(fe);
|
2009-12-23 08:08:49 +08:00
|
|
|
default:
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-10 06:26:28 +08:00
|
|
|
/* Nothing to do here, as stats are automatically updated */
|
2013-03-09 23:05:58 +08:00
|
|
|
static int smsdvb_get_frontend(struct dvb_frontend *fe)
|
|
|
|
{
|
2013-03-10 06:26:28 +08:00
|
|
|
return 0;
|
2008-11-23 01:26:37 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int smsdvb_init(struct dvb_frontend *fe)
|
|
|
|
{
|
|
|
|
struct smsdvb_client_t *client =
|
|
|
|
container_of(fe, struct smsdvb_client_t, frontend);
|
|
|
|
|
2009-07-13 10:30:14 +08:00
|
|
|
sms_board_power(client->coredev, 1);
|
|
|
|
|
2009-05-12 23:28:46 +08:00
|
|
|
sms_board_dvb3_event(client, DVB3_EVENT_INIT);
|
2008-11-23 01:26:37 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int smsdvb_sleep(struct dvb_frontend *fe)
|
|
|
|
{
|
|
|
|
struct smsdvb_client_t *client =
|
|
|
|
container_of(fe, struct smsdvb_client_t, frontend);
|
|
|
|
|
2009-07-13 10:30:14 +08:00
|
|
|
sms_board_led_feedback(client->coredev, SMS_LED_OFF);
|
|
|
|
sms_board_power(client->coredev, 0);
|
|
|
|
|
2009-05-12 23:28:46 +08:00
|
|
|
sms_board_dvb3_event(client, DVB3_EVENT_SLEEP);
|
2008-11-23 01:26:37 +08:00
|
|
|
|
2008-05-20 05:56:13 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void smsdvb_release(struct dvb_frontend *fe)
|
|
|
|
{
|
2008-06-16 02:52:43 +08:00
|
|
|
/* do nothing */
|
2008-05-20 05:56:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static struct dvb_frontend_ops smsdvb_fe_ops = {
|
|
|
|
.info = {
|
V4L/DVB (10750): import changes from Siano
Import the following changes from Uri Shkolnik
* Two-ways merge with Siano internal repository
* Continuing with DVB sub-system separation
* kconfig and makefile updates
* Code cleanup
This is a work-in-progress sync with Siano's internal repository.
Some changes had to be altered or dropped in order not to break the build.
This breaks normal operation for the current driver, but it is being committed
now for tracking purposes.
These changes introduce the following checkpatch.pl violations:
ERROR: do not use C99 // comments
156: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1373:
+//#ifdef DVB_CORE
ERROR: do not use C99 // comments
157: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1374:
+// smsdvb_unregister();
ERROR: do not use C99 // comments
158: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1375:
+//#endif
WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
163: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1380:
+EXPORT_SYMBOL(smscore_onresponse);
WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
164: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1381:
+EXPORT_SYMBOL(sms_get_board);
WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
165: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1382:
+EXPORT_SYMBOL(sms_debug);
WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
166: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1383:
+EXPORT_SYMBOL(smscore_putbuffer);
WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
167: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1384:
+EXPORT_SYMBOL(smscore_registry_getmode);
WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
168: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1385:
+EXPORT_SYMBOL(smscore_register_device);
WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
169: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1386:
+EXPORT_SYMBOL(smscore_set_board_id);
WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
170: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1387:
+EXPORT_SYMBOL(smscore_start_device);
WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
171: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1388:
+EXPORT_SYMBOL(smsusb_id_table);
WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
172: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1389:
+EXPORT_SYMBOL(smscore_unregister_device);
WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
173: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1390:
+EXPORT_SYMBOL(smscore_getbuffer);
WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
174: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1391:
+EXPORT_SYMBOL(smscore_get_device_mode);
WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
175: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1392:
+EXPORT_SYMBOL(smscore_register_client);
WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
176: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1393:
+EXPORT_SYMBOL(smscore_unregister_hotplug);
WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
177: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1394:
+EXPORT_SYMBOL(smsclient_sendrequest);
WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
178: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1395:
+EXPORT_SYMBOL(smscore_unregister_client);
WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
179: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1396:
+EXPORT_SYMBOL(smscore_get_board_id);
WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
180: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1397:
+EXPORT_SYMBOL(smscore_register_hotplug);
WARNING: line over 80 characters
391: FILE: linux/drivers/media/dvb/siano/smscoreapi.h:398:
+extern int smscore_get_fw_filename(struct smscore_device_t *coredev, int mode, char* filename);
ERROR: "foo* bar" should be "foo *bar"
391: FILE: linux/drivers/media/dvb/siano/smscoreapi.h:398:
+extern int smscore_get_fw_filename(struct smscore_device_t *coredev, int mode, char* filename);
WARNING: line over 80 characters
392: FILE: linux/drivers/media/dvb/siano/smscoreapi.h:399:
+extern int smscore_send_fw_file(struct smscore_device_t *coredev, u8* ufwbuf,int size);
ERROR: "foo* bar" should be "foo *bar"
392: FILE: linux/drivers/media/dvb/siano/smscoreapi.h:399:
+extern int smscore_send_fw_file(struct smscore_device_t *coredev, u8* ufwbuf,int size);
ERROR: space required after that ',' (ctx:VxV)
392: FILE: linux/drivers/media/dvb/siano/smscoreapi.h:399:
+extern int smscore_send_fw_file(struct smscore_device_t *coredev, u8* ufwbuf,int size);
^
WARNING: __func__ should be used instead of gcc specific __FUNCTION__
489: FILE: linux/drivers/media/dvb/siano/smsusb.c:443:
+ printk(KERN_INFO"%s Entering status %d.\n", __FUNCTION__, msg.event);
WARNING: __func__ should be used instead of gcc specific __FUNCTION__
501: FILE: linux/drivers/media/dvb/siano/smsusb.c:455:
+ printk(KERN_INFO "%s Entering.\n", __FUNCTION__);
ERROR: space prohibited before that '++' (ctx:WxB)
505: FILE: linux/drivers/media/dvb/siano/smsusb.c:459:
+ for (i = 0; i < intf->cur_altsetting->desc.bNumEndpoints; i ++)
^
WARNING: __func__ should be used instead of gcc specific __FUNCTION__
517: FILE: linux/drivers/media/dvb/siano/smsusb.c:471:
+ __FUNCTION__, rc);
total: 7 errors, 23 warnings, 524 lines checked
Signed-off-by: Uri Shkolnik <uris@siano-ms.com>
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-08-31 11:44:04 +08:00
|
|
|
.name = "Siano Mobile Digital MDTV Receiver",
|
2008-05-20 05:56:13 +08:00
|
|
|
.frequency_min = 44250000,
|
|
|
|
.frequency_max = 867250000,
|
|
|
|
.frequency_stepsize = 250000,
|
|
|
|
.caps = FE_CAN_INVERSION_AUTO |
|
2008-06-16 02:14:13 +08:00
|
|
|
FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 |
|
|
|
|
FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO |
|
|
|
|
FE_CAN_QPSK | FE_CAN_QAM_16 | FE_CAN_QAM_64 |
|
|
|
|
FE_CAN_QAM_AUTO | FE_CAN_TRANSMISSION_MODE_AUTO |
|
|
|
|
FE_CAN_GUARD_INTERVAL_AUTO |
|
|
|
|
FE_CAN_RECOVER |
|
|
|
|
FE_CAN_HIERARCHY_AUTO,
|
2008-05-20 05:56:13 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
.release = smsdvb_release,
|
|
|
|
|
2011-12-27 03:31:29 +08:00
|
|
|
.set_frontend = smsdvb_set_frontend,
|
|
|
|
.get_frontend = smsdvb_get_frontend,
|
2008-05-20 05:56:13 +08:00
|
|
|
.get_tune_settings = smsdvb_get_tune_settings,
|
|
|
|
|
|
|
|
.read_status = smsdvb_read_status,
|
|
|
|
.read_ber = smsdvb_read_ber,
|
|
|
|
.read_signal_strength = smsdvb_read_signal_strength,
|
|
|
|
.read_snr = smsdvb_read_snr,
|
2008-11-23 01:56:37 +08:00
|
|
|
.read_ucblocks = smsdvb_read_ucblocks,
|
2008-11-23 01:26:37 +08:00
|
|
|
|
|
|
|
.init = smsdvb_init,
|
|
|
|
.sleep = smsdvb_sleep,
|
2008-05-20 05:56:13 +08:00
|
|
|
};
|
|
|
|
|
2008-06-21 13:44:02 +08:00
|
|
|
static int smsdvb_hotplug(struct smscore_device_t *coredev,
|
|
|
|
struct device *device, int arrival)
|
2008-05-20 05:56:13 +08:00
|
|
|
{
|
2008-06-16 04:52:24 +08:00
|
|
|
struct smsclient_params_t params;
|
|
|
|
struct smsdvb_client_t *client;
|
2008-05-20 05:56:13 +08:00
|
|
|
int rc;
|
|
|
|
|
2008-06-16 02:52:43 +08:00
|
|
|
/* device removal handled by onremove callback */
|
2008-05-20 05:56:13 +08:00
|
|
|
if (!arrival)
|
|
|
|
return 0;
|
2008-06-16 04:52:24 +08:00
|
|
|
client = kzalloc(sizeof(struct smsdvb_client_t), GFP_KERNEL);
|
2015-02-22 22:04:35 +08:00
|
|
|
if (!client)
|
2008-05-20 05:56:13 +08:00
|
|
|
return -ENOMEM;
|
|
|
|
|
2008-06-16 02:52:43 +08:00
|
|
|
/* register dvb adapter */
|
2008-06-19 09:09:55 +08:00
|
|
|
rc = dvb_register_adapter(&client->adapter,
|
|
|
|
sms_get_board(
|
|
|
|
smscore_get_board_id(coredev))->name,
|
2008-06-16 02:14:13 +08:00
|
|
|
THIS_MODULE, device, adapter_nr);
|
|
|
|
if (rc < 0) {
|
2015-02-22 22:04:35 +08:00
|
|
|
pr_err("dvb_register_adapter() failed %d\n", rc);
|
2008-05-20 05:56:13 +08:00
|
|
|
goto adapter_error;
|
|
|
|
}
|
2015-01-07 19:03:03 +08:00
|
|
|
#ifdef CONFIG_MEDIA_CONTROLLER_DVB
|
|
|
|
client->adapter.mdev = coredev->media_dev;
|
|
|
|
#endif
|
2008-05-20 05:56:13 +08:00
|
|
|
|
2008-06-16 02:52:43 +08:00
|
|
|
/* init dvb demux */
|
2008-05-20 05:56:13 +08:00
|
|
|
client->demux.dmx.capabilities = DMX_TS_FILTERING;
|
2008-06-16 02:52:43 +08:00
|
|
|
client->demux.filternum = 32; /* todo: nova ??? */
|
2008-05-20 05:56:13 +08:00
|
|
|
client->demux.feednum = 32;
|
|
|
|
client->demux.start_feed = smsdvb_start_feed;
|
|
|
|
client->demux.stop_feed = smsdvb_stop_feed;
|
|
|
|
|
|
|
|
rc = dvb_dmx_init(&client->demux);
|
2008-06-16 02:14:13 +08:00
|
|
|
if (rc < 0) {
|
2015-02-22 22:04:35 +08:00
|
|
|
pr_err("dvb_dmx_init failed %d\n", rc);
|
2008-05-20 05:56:13 +08:00
|
|
|
goto dvbdmx_error;
|
|
|
|
}
|
|
|
|
|
2008-06-16 02:52:43 +08:00
|
|
|
/* init dmxdev */
|
2008-05-20 05:56:13 +08:00
|
|
|
client->dmxdev.filternum = 32;
|
|
|
|
client->dmxdev.demux = &client->demux.dmx;
|
|
|
|
client->dmxdev.capabilities = 0;
|
|
|
|
|
|
|
|
rc = dvb_dmxdev_init(&client->dmxdev, &client->adapter);
|
2008-06-16 02:14:13 +08:00
|
|
|
if (rc < 0) {
|
2015-02-22 22:04:35 +08:00
|
|
|
pr_err("dvb_dmxdev_init failed %d\n", rc);
|
2008-05-20 05:56:13 +08:00
|
|
|
goto dmxdev_error;
|
|
|
|
}
|
|
|
|
|
2008-06-16 02:52:43 +08:00
|
|
|
/* init and register frontend */
|
2008-06-16 02:14:13 +08:00
|
|
|
memcpy(&client->frontend.ops, &smsdvb_fe_ops,
|
|
|
|
sizeof(struct dvb_frontend_ops));
|
2008-05-20 05:56:13 +08:00
|
|
|
|
2011-12-27 03:31:29 +08:00
|
|
|
switch (smscore_get_device_mode(coredev)) {
|
|
|
|
case DEVICE_MODE_DVBT:
|
|
|
|
case DEVICE_MODE_DVBT_BDA:
|
2012-03-01 18:25:39 +08:00
|
|
|
client->frontend.ops.delsys[0] = SYS_DVBT;
|
2011-12-27 03:31:29 +08:00
|
|
|
break;
|
|
|
|
case DEVICE_MODE_ISDBT:
|
|
|
|
case DEVICE_MODE_ISDBT_BDA:
|
2012-03-01 18:25:39 +08:00
|
|
|
client->frontend.ops.delsys[0] = SYS_ISDBT;
|
2011-12-27 03:31:29 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2008-05-20 05:56:13 +08:00
|
|
|
rc = dvb_register_frontend(&client->adapter, &client->frontend);
|
2008-06-16 02:14:13 +08:00
|
|
|
if (rc < 0) {
|
2015-02-22 22:04:35 +08:00
|
|
|
pr_err("frontend registration failed %d\n", rc);
|
2008-05-20 05:56:13 +08:00
|
|
|
goto frontend_error;
|
|
|
|
}
|
|
|
|
|
2008-06-14 11:43:26 +08:00
|
|
|
params.initial_id = 1;
|
2008-05-20 05:56:13 +08:00
|
|
|
params.data_type = MSG_SMS_DVBT_BDA_DATA;
|
|
|
|
params.onresponse_handler = smsdvb_onresponse;
|
|
|
|
params.onremove_handler = smsdvb_onremove;
|
|
|
|
params.context = client;
|
|
|
|
|
|
|
|
rc = smscore_register_client(coredev, ¶ms, &client->smsclient);
|
2008-06-16 02:14:13 +08:00
|
|
|
if (rc < 0) {
|
2015-02-22 22:04:35 +08:00
|
|
|
pr_err("smscore_register_client() failed %d\n", rc);
|
2008-05-20 05:56:13 +08:00
|
|
|
goto client_error;
|
|
|
|
}
|
|
|
|
|
|
|
|
client->coredev = coredev;
|
|
|
|
|
|
|
|
init_completion(&client->tune_done);
|
2013-03-08 03:32:33 +08:00
|
|
|
init_completion(&client->stats_done);
|
2008-05-20 05:56:13 +08:00
|
|
|
|
|
|
|
kmutex_lock(&g_smsdvb_clientslock);
|
|
|
|
|
|
|
|
list_add(&client->entry, &g_smsdvb_clients);
|
|
|
|
|
|
|
|
kmutex_unlock(&g_smsdvb_clientslock);
|
|
|
|
|
2009-05-12 23:28:46 +08:00
|
|
|
client->event_fe_state = -1;
|
|
|
|
client->event_unc_state = -1;
|
|
|
|
sms_board_dvb3_event(client, DVB3_EVENT_HOTPLUG);
|
2008-05-20 05:56:13 +08:00
|
|
|
|
2015-02-22 22:49:28 +08:00
|
|
|
pr_debug("success\n");
|
2008-11-17 09:45:42 +08:00
|
|
|
sms_board_setup(coredev);
|
|
|
|
|
2013-03-10 20:04:44 +08:00
|
|
|
if (smsdvb_debugfs_create(client) < 0)
|
2015-02-22 22:49:28 +08:00
|
|
|
pr_info("failed to create debugfs node\n");
|
2013-03-10 09:33:06 +08:00
|
|
|
|
2015-01-07 19:03:03 +08:00
|
|
|
dvb_create_media_graph(coredev->media_dev);
|
|
|
|
|
2008-05-20 05:56:13 +08:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
client_error:
|
|
|
|
dvb_unregister_frontend(&client->frontend);
|
|
|
|
|
|
|
|
frontend_error:
|
|
|
|
dvb_dmxdev_release(&client->dmxdev);
|
|
|
|
|
|
|
|
dmxdev_error:
|
|
|
|
dvb_dmx_release(&client->demux);
|
|
|
|
|
|
|
|
dvbdmx_error:
|
2015-01-07 19:03:03 +08:00
|
|
|
smsdvb_media_device_unregister(client);
|
2008-05-20 05:56:13 +08:00
|
|
|
dvb_unregister_adapter(&client->adapter);
|
|
|
|
|
|
|
|
adapter_error:
|
|
|
|
kfree(client);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2009-12-12 07:05:10 +08:00
|
|
|
static int __init smsdvb_module_init(void)
|
2008-05-23 05:04:36 +08:00
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
INIT_LIST_HEAD(&g_smsdvb_clients);
|
|
|
|
kmutex_init(&g_smsdvb_clientslock);
|
|
|
|
|
2013-03-10 20:04:44 +08:00
|
|
|
smsdvb_debugfs_register();
|
2013-03-10 09:33:06 +08:00
|
|
|
|
2008-05-23 05:04:36 +08:00
|
|
|
rc = smscore_register_hotplug(smsdvb_hotplug);
|
|
|
|
|
2015-02-22 22:33:37 +08:00
|
|
|
pr_debug("\n");
|
2008-05-23 05:04:36 +08:00
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2009-12-12 07:05:10 +08:00
|
|
|
static void __exit smsdvb_module_exit(void)
|
2008-05-23 05:04:36 +08:00
|
|
|
{
|
|
|
|
smscore_unregister_hotplug(smsdvb_hotplug);
|
|
|
|
|
|
|
|
kmutex_lock(&g_smsdvb_clientslock);
|
|
|
|
|
|
|
|
while (!list_empty(&g_smsdvb_clients))
|
2013-03-10 20:04:44 +08:00
|
|
|
smsdvb_unregister_client((struct smsdvb_client_t *)g_smsdvb_clients.next);
|
2008-05-23 05:04:36 +08:00
|
|
|
|
2013-03-10 20:04:44 +08:00
|
|
|
smsdvb_debugfs_unregister();
|
2013-03-10 09:33:06 +08:00
|
|
|
|
2008-05-23 05:04:36 +08:00
|
|
|
kmutex_unlock(&g_smsdvb_clientslock);
|
|
|
|
}
|
V4L/DVB (10750): import changes from Siano
Import the following changes from Uri Shkolnik
* Two-ways merge with Siano internal repository
* Continuing with DVB sub-system separation
* kconfig and makefile updates
* Code cleanup
This is a work-in-progress sync with Siano's internal repository.
Some changes had to be altered or dropped in order not to break the build.
This breaks normal operation for the current driver, but it is being committed
now for tracking purposes.
These changes introduce the following checkpatch.pl violations:
ERROR: do not use C99 // comments
156: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1373:
+//#ifdef DVB_CORE
ERROR: do not use C99 // comments
157: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1374:
+// smsdvb_unregister();
ERROR: do not use C99 // comments
158: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1375:
+//#endif
WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
163: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1380:
+EXPORT_SYMBOL(smscore_onresponse);
WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
164: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1381:
+EXPORT_SYMBOL(sms_get_board);
WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
165: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1382:
+EXPORT_SYMBOL(sms_debug);
WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
166: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1383:
+EXPORT_SYMBOL(smscore_putbuffer);
WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
167: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1384:
+EXPORT_SYMBOL(smscore_registry_getmode);
WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
168: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1385:
+EXPORT_SYMBOL(smscore_register_device);
WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
169: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1386:
+EXPORT_SYMBOL(smscore_set_board_id);
WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
170: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1387:
+EXPORT_SYMBOL(smscore_start_device);
WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
171: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1388:
+EXPORT_SYMBOL(smsusb_id_table);
WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
172: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1389:
+EXPORT_SYMBOL(smscore_unregister_device);
WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
173: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1390:
+EXPORT_SYMBOL(smscore_getbuffer);
WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
174: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1391:
+EXPORT_SYMBOL(smscore_get_device_mode);
WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
175: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1392:
+EXPORT_SYMBOL(smscore_register_client);
WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
176: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1393:
+EXPORT_SYMBOL(smscore_unregister_hotplug);
WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
177: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1394:
+EXPORT_SYMBOL(smsclient_sendrequest);
WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
178: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1395:
+EXPORT_SYMBOL(smscore_unregister_client);
WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
179: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1396:
+EXPORT_SYMBOL(smscore_get_board_id);
WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
180: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1397:
+EXPORT_SYMBOL(smscore_register_hotplug);
WARNING: line over 80 characters
391: FILE: linux/drivers/media/dvb/siano/smscoreapi.h:398:
+extern int smscore_get_fw_filename(struct smscore_device_t *coredev, int mode, char* filename);
ERROR: "foo* bar" should be "foo *bar"
391: FILE: linux/drivers/media/dvb/siano/smscoreapi.h:398:
+extern int smscore_get_fw_filename(struct smscore_device_t *coredev, int mode, char* filename);
WARNING: line over 80 characters
392: FILE: linux/drivers/media/dvb/siano/smscoreapi.h:399:
+extern int smscore_send_fw_file(struct smscore_device_t *coredev, u8* ufwbuf,int size);
ERROR: "foo* bar" should be "foo *bar"
392: FILE: linux/drivers/media/dvb/siano/smscoreapi.h:399:
+extern int smscore_send_fw_file(struct smscore_device_t *coredev, u8* ufwbuf,int size);
ERROR: space required after that ',' (ctx:VxV)
392: FILE: linux/drivers/media/dvb/siano/smscoreapi.h:399:
+extern int smscore_send_fw_file(struct smscore_device_t *coredev, u8* ufwbuf,int size);
^
WARNING: __func__ should be used instead of gcc specific __FUNCTION__
489: FILE: linux/drivers/media/dvb/siano/smsusb.c:443:
+ printk(KERN_INFO"%s Entering status %d.\n", __FUNCTION__, msg.event);
WARNING: __func__ should be used instead of gcc specific __FUNCTION__
501: FILE: linux/drivers/media/dvb/siano/smsusb.c:455:
+ printk(KERN_INFO "%s Entering.\n", __FUNCTION__);
ERROR: space prohibited before that '++' (ctx:WxB)
505: FILE: linux/drivers/media/dvb/siano/smsusb.c:459:
+ for (i = 0; i < intf->cur_altsetting->desc.bNumEndpoints; i ++)
^
WARNING: __func__ should be used instead of gcc specific __FUNCTION__
517: FILE: linux/drivers/media/dvb/siano/smsusb.c:471:
+ __FUNCTION__, rc);
total: 7 errors, 23 warnings, 524 lines checked
Signed-off-by: Uri Shkolnik <uris@siano-ms.com>
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-08-31 11:44:04 +08:00
|
|
|
|
|
|
|
module_init(smsdvb_module_init);
|
|
|
|
module_exit(smsdvb_module_exit);
|
|
|
|
|
|
|
|
MODULE_DESCRIPTION("SMS DVB subsystem adaptation module");
|
2009-05-13 00:13:13 +08:00
|
|
|
MODULE_AUTHOR("Siano Mobile Silicon, Inc. (uris@siano-ms.com)");
|
V4L/DVB (10750): import changes from Siano
Import the following changes from Uri Shkolnik
* Two-ways merge with Siano internal repository
* Continuing with DVB sub-system separation
* kconfig and makefile updates
* Code cleanup
This is a work-in-progress sync with Siano's internal repository.
Some changes had to be altered or dropped in order not to break the build.
This breaks normal operation for the current driver, but it is being committed
now for tracking purposes.
These changes introduce the following checkpatch.pl violations:
ERROR: do not use C99 // comments
156: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1373:
+//#ifdef DVB_CORE
ERROR: do not use C99 // comments
157: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1374:
+// smsdvb_unregister();
ERROR: do not use C99 // comments
158: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1375:
+//#endif
WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
163: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1380:
+EXPORT_SYMBOL(smscore_onresponse);
WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
164: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1381:
+EXPORT_SYMBOL(sms_get_board);
WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
165: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1382:
+EXPORT_SYMBOL(sms_debug);
WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
166: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1383:
+EXPORT_SYMBOL(smscore_putbuffer);
WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
167: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1384:
+EXPORT_SYMBOL(smscore_registry_getmode);
WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
168: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1385:
+EXPORT_SYMBOL(smscore_register_device);
WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
169: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1386:
+EXPORT_SYMBOL(smscore_set_board_id);
WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
170: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1387:
+EXPORT_SYMBOL(smscore_start_device);
WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
171: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1388:
+EXPORT_SYMBOL(smsusb_id_table);
WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
172: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1389:
+EXPORT_SYMBOL(smscore_unregister_device);
WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
173: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1390:
+EXPORT_SYMBOL(smscore_getbuffer);
WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
174: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1391:
+EXPORT_SYMBOL(smscore_get_device_mode);
WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
175: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1392:
+EXPORT_SYMBOL(smscore_register_client);
WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
176: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1393:
+EXPORT_SYMBOL(smscore_unregister_hotplug);
WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
177: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1394:
+EXPORT_SYMBOL(smsclient_sendrequest);
WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
178: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1395:
+EXPORT_SYMBOL(smscore_unregister_client);
WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
179: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1396:
+EXPORT_SYMBOL(smscore_get_board_id);
WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
180: FILE: linux/drivers/media/dvb/siano/smscoreapi.c:1397:
+EXPORT_SYMBOL(smscore_register_hotplug);
WARNING: line over 80 characters
391: FILE: linux/drivers/media/dvb/siano/smscoreapi.h:398:
+extern int smscore_get_fw_filename(struct smscore_device_t *coredev, int mode, char* filename);
ERROR: "foo* bar" should be "foo *bar"
391: FILE: linux/drivers/media/dvb/siano/smscoreapi.h:398:
+extern int smscore_get_fw_filename(struct smscore_device_t *coredev, int mode, char* filename);
WARNING: line over 80 characters
392: FILE: linux/drivers/media/dvb/siano/smscoreapi.h:399:
+extern int smscore_send_fw_file(struct smscore_device_t *coredev, u8* ufwbuf,int size);
ERROR: "foo* bar" should be "foo *bar"
392: FILE: linux/drivers/media/dvb/siano/smscoreapi.h:399:
+extern int smscore_send_fw_file(struct smscore_device_t *coredev, u8* ufwbuf,int size);
ERROR: space required after that ',' (ctx:VxV)
392: FILE: linux/drivers/media/dvb/siano/smscoreapi.h:399:
+extern int smscore_send_fw_file(struct smscore_device_t *coredev, u8* ufwbuf,int size);
^
WARNING: __func__ should be used instead of gcc specific __FUNCTION__
489: FILE: linux/drivers/media/dvb/siano/smsusb.c:443:
+ printk(KERN_INFO"%s Entering status %d.\n", __FUNCTION__, msg.event);
WARNING: __func__ should be used instead of gcc specific __FUNCTION__
501: FILE: linux/drivers/media/dvb/siano/smsusb.c:455:
+ printk(KERN_INFO "%s Entering.\n", __FUNCTION__);
ERROR: space prohibited before that '++' (ctx:WxB)
505: FILE: linux/drivers/media/dvb/siano/smsusb.c:459:
+ for (i = 0; i < intf->cur_altsetting->desc.bNumEndpoints; i ++)
^
WARNING: __func__ should be used instead of gcc specific __FUNCTION__
517: FILE: linux/drivers/media/dvb/siano/smsusb.c:471:
+ __FUNCTION__, rc);
total: 7 errors, 23 warnings, 524 lines checked
Signed-off-by: Uri Shkolnik <uris@siano-ms.com>
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-08-31 11:44:04 +08:00
|
|
|
MODULE_LICENSE("GPL");
|