2009-04-27 06:09:47 -06: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-22 15:05:26 -06:00
|
|
|
|
2008-05-19 15:56:13 -06: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 02:04:11 -06:00
|
|
|
#include <linux/slab.h>
|
2008-05-19 15:56:13 -06:00
|
|
|
#include <linux/init.h>
|
|
|
|
|
2009-05-14 13:28:17 -06:00
|
|
|
#include "dmxdev.h"
|
|
|
|
#include "dvbdev.h"
|
|
|
|
#include "dvb_demux.h"
|
|
|
|
#include "dvb_frontend.h"
|
|
|
|
|
2008-05-19 15:56:13 -06:00
|
|
|
#include "smscoreapi.h"
|
2009-05-12 08:37:09 -06:00
|
|
|
#include "smsendian.h"
|
2008-06-18 19:09:55 -06:00
|
|
|
#include "sms-cards.h"
|
2008-05-19 15:56:13 -06:00
|
|
|
|
2008-05-19 15:57:12 -06:00
|
|
|
DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
|
|
|
|
|
2008-08-31 14:15:47 -06:00
|
|
|
struct smsdvb_client_t {
|
|
|
|
struct list_head entry;
|
|
|
|
|
|
|
|
struct smscore_device_t *coredev;
|
|
|
|
struct smscore_client_t *smsclient;
|
|
|
|
|
|
|
|
struct dvb_adapter adapter;
|
|
|
|
struct dvb_demux demux;
|
|
|
|
struct dmxdev dmxdev;
|
|
|
|
struct dvb_frontend frontend;
|
|
|
|
|
|
|
|
fe_status_t fe_status;
|
|
|
|
|
2009-05-12 09:28:46 -06:00
|
|
|
struct completion tune_done;
|
2008-08-31 14:15:47 -06:00
|
|
|
|
2009-05-12 09:28:46 -06:00
|
|
|
struct SMSHOSTLIB_STATISTICS_DVB_S sms_stat_dvb;
|
|
|
|
int event_fe_state;
|
|
|
|
int event_unc_state;
|
2008-08-31 14:15:47 -06:00
|
|
|
};
|
|
|
|
|
2008-07-21 20:17:36 -06:00
|
|
|
static struct list_head g_smsdvb_clients;
|
|
|
|
static struct mutex g_smsdvb_clientslock;
|
2008-05-19 15:56:13 -06:00
|
|
|
|
2009-02-26 22:42:16 -07:00
|
|
|
static int sms_dbg;
|
|
|
|
module_param_named(debug, sms_dbg, int, 0644);
|
|
|
|
MODULE_PARM_DESC(debug, "set debug level (info=1, adv=2 (or-able))");
|
|
|
|
|
2009-05-12 09:28:46 -06: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 09:28:02 -06:00
|
|
|
|
|
|
|
struct smscore_device_t *coredev = client->coredev;
|
|
|
|
switch (event) {
|
|
|
|
case DVB3_EVENT_INIT:
|
|
|
|
sms_debug("DVB3_EVENT_INIT");
|
|
|
|
sms_board_event(coredev, BOARD_EVENT_BIND);
|
|
|
|
break;
|
|
|
|
case DVB3_EVENT_SLEEP:
|
|
|
|
sms_debug("DVB3_EVENT_SLEEP");
|
|
|
|
sms_board_event(coredev, BOARD_EVENT_POWER_SUSPEND);
|
|
|
|
break;
|
|
|
|
case DVB3_EVENT_HOTPLUG:
|
|
|
|
sms_debug("DVB3_EVENT_HOTPLUG");
|
|
|
|
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;
|
|
|
|
sms_debug("DVB3_EVENT_FE_LOCK");
|
|
|
|
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;
|
|
|
|
sms_debug("DVB3_EVENT_FE_UNLOCK");
|
|
|
|
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;
|
|
|
|
sms_debug("DVB3_EVENT_UNC_OK");
|
|
|
|
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;
|
|
|
|
sms_debug("DVB3_EVENT_UNC_ERR");
|
|
|
|
sms_board_event(coredev, BOARD_EVENT_MULTIPLEX_ERRORS);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
sms_err("Unknown dvb3 api event");
|
|
|
|
break;
|
|
|
|
}
|
2009-05-12 09:28:46 -06:00
|
|
|
}
|
|
|
|
|
2009-12-25 07:29:42 -07:00
|
|
|
|
|
|
|
static void smsdvb_update_dvb_stats(struct RECEPTION_STATISTICS_S *pReceptionData,
|
|
|
|
struct SMSHOSTLIB_STATISTICS_ST *p)
|
|
|
|
{
|
|
|
|
if (sms_dbg & 2) {
|
|
|
|
printk(KERN_DEBUG "Reserved = %d", p->Reserved);
|
|
|
|
printk(KERN_DEBUG "IsRfLocked = %d", p->IsRfLocked);
|
|
|
|
printk(KERN_DEBUG "IsDemodLocked = %d", p->IsDemodLocked);
|
|
|
|
printk(KERN_DEBUG "IsExternalLNAOn = %d", p->IsExternalLNAOn);
|
|
|
|
printk(KERN_DEBUG "SNR = %d", p->SNR);
|
|
|
|
printk(KERN_DEBUG "BER = %d", p->BER);
|
|
|
|
printk(KERN_DEBUG "FIB_CRC = %d", p->FIB_CRC);
|
|
|
|
printk(KERN_DEBUG "TS_PER = %d", p->TS_PER);
|
|
|
|
printk(KERN_DEBUG "MFER = %d", p->MFER);
|
|
|
|
printk(KERN_DEBUG "RSSI = %d", p->RSSI);
|
|
|
|
printk(KERN_DEBUG "InBandPwr = %d", p->InBandPwr);
|
|
|
|
printk(KERN_DEBUG "CarrierOffset = %d", p->CarrierOffset);
|
|
|
|
printk(KERN_DEBUG "Frequency = %d", p->Frequency);
|
|
|
|
printk(KERN_DEBUG "Bandwidth = %d", p->Bandwidth);
|
|
|
|
printk(KERN_DEBUG "TransmissionMode = %d", p->TransmissionMode);
|
|
|
|
printk(KERN_DEBUG "ModemState = %d", p->ModemState);
|
|
|
|
printk(KERN_DEBUG "GuardInterval = %d", p->GuardInterval);
|
|
|
|
printk(KERN_DEBUG "CodeRate = %d", p->CodeRate);
|
|
|
|
printk(KERN_DEBUG "LPCodeRate = %d", p->LPCodeRate);
|
|
|
|
printk(KERN_DEBUG "Hierarchy = %d", p->Hierarchy);
|
|
|
|
printk(KERN_DEBUG "Constellation = %d", p->Constellation);
|
|
|
|
printk(KERN_DEBUG "BurstSize = %d", p->BurstSize);
|
|
|
|
printk(KERN_DEBUG "BurstDuration = %d", p->BurstDuration);
|
|
|
|
printk(KERN_DEBUG "BurstCycleTime = %d", p->BurstCycleTime);
|
|
|
|
printk(KERN_DEBUG "CalculatedBurstCycleTime = %d", p->CalculatedBurstCycleTime);
|
|
|
|
printk(KERN_DEBUG "NumOfRows = %d", p->NumOfRows);
|
|
|
|
printk(KERN_DEBUG "NumOfPaddCols = %d", p->NumOfPaddCols);
|
|
|
|
printk(KERN_DEBUG "NumOfPunctCols = %d", p->NumOfPunctCols);
|
|
|
|
printk(KERN_DEBUG "ErrorTSPackets = %d", p->ErrorTSPackets);
|
|
|
|
printk(KERN_DEBUG "TotalTSPackets = %d", p->TotalTSPackets);
|
|
|
|
printk(KERN_DEBUG "NumOfValidMpeTlbs = %d", p->NumOfValidMpeTlbs);
|
|
|
|
printk(KERN_DEBUG "NumOfInvalidMpeTlbs = %d", p->NumOfInvalidMpeTlbs);
|
|
|
|
printk(KERN_DEBUG "NumOfCorrectedMpeTlbs = %d", p->NumOfCorrectedMpeTlbs);
|
|
|
|
printk(KERN_DEBUG "BERErrorCount = %d", p->BERErrorCount);
|
|
|
|
printk(KERN_DEBUG "BERBitCount = %d", p->BERBitCount);
|
|
|
|
printk(KERN_DEBUG "SmsToHostTxErrors = %d", p->SmsToHostTxErrors);
|
|
|
|
printk(KERN_DEBUG "PreBER = %d", p->PreBER);
|
|
|
|
printk(KERN_DEBUG "CellId = %d", p->CellId);
|
|
|
|
printk(KERN_DEBUG "DvbhSrvIndHP = %d", p->DvbhSrvIndHP);
|
|
|
|
printk(KERN_DEBUG "DvbhSrvIndLP = %d", p->DvbhSrvIndLP);
|
|
|
|
printk(KERN_DEBUG "NumMPEReceived = %d", p->NumMPEReceived);
|
|
|
|
}
|
|
|
|
|
|
|
|
pReceptionData->IsDemodLocked = p->IsDemodLocked;
|
|
|
|
|
|
|
|
pReceptionData->SNR = p->SNR;
|
|
|
|
pReceptionData->BER = p->BER;
|
|
|
|
pReceptionData->BERErrorCount = p->BERErrorCount;
|
|
|
|
pReceptionData->InBandPwr = p->InBandPwr;
|
|
|
|
pReceptionData->ErrorTSPackets = p->ErrorTSPackets;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static void smsdvb_update_isdbt_stats(struct RECEPTION_STATISTICS_S *pReceptionData,
|
|
|
|
struct SMSHOSTLIB_STATISTICS_ISDBT_ST *p)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (sms_dbg & 2) {
|
|
|
|
printk(KERN_DEBUG "IsRfLocked = %d", p->IsRfLocked);
|
|
|
|
printk(KERN_DEBUG "IsDemodLocked = %d", p->IsDemodLocked);
|
|
|
|
printk(KERN_DEBUG "IsExternalLNAOn = %d", p->IsExternalLNAOn);
|
|
|
|
printk(KERN_DEBUG "SNR = %d", p->SNR);
|
|
|
|
printk(KERN_DEBUG "RSSI = %d", p->RSSI);
|
|
|
|
printk(KERN_DEBUG "InBandPwr = %d", p->InBandPwr);
|
|
|
|
printk(KERN_DEBUG "CarrierOffset = %d", p->CarrierOffset);
|
|
|
|
printk(KERN_DEBUG "Frequency = %d", p->Frequency);
|
|
|
|
printk(KERN_DEBUG "Bandwidth = %d", p->Bandwidth);
|
|
|
|
printk(KERN_DEBUG "TransmissionMode = %d", p->TransmissionMode);
|
|
|
|
printk(KERN_DEBUG "ModemState = %d", p->ModemState);
|
|
|
|
printk(KERN_DEBUG "GuardInterval = %d", p->GuardInterval);
|
|
|
|
printk(KERN_DEBUG "SystemType = %d", p->SystemType);
|
|
|
|
printk(KERN_DEBUG "PartialReception = %d", p->PartialReception);
|
|
|
|
printk(KERN_DEBUG "NumOfLayers = %d", p->NumOfLayers);
|
|
|
|
printk(KERN_DEBUG "SmsToHostTxErrors = %d", p->SmsToHostTxErrors);
|
|
|
|
|
|
|
|
for (i = 0; i < 3; i++) {
|
|
|
|
printk(KERN_DEBUG "%d: CodeRate = %d", i, p->LayerInfo[i].CodeRate);
|
|
|
|
printk(KERN_DEBUG "%d: Constellation = %d", i, p->LayerInfo[i].Constellation);
|
|
|
|
printk(KERN_DEBUG "%d: BER = %d", i, p->LayerInfo[i].BER);
|
|
|
|
printk(KERN_DEBUG "%d: BERErrorCount = %d", i, p->LayerInfo[i].BERErrorCount);
|
|
|
|
printk(KERN_DEBUG "%d: BERBitCount = %d", i, p->LayerInfo[i].BERBitCount);
|
|
|
|
printk(KERN_DEBUG "%d: PreBER = %d", i, p->LayerInfo[i].PreBER);
|
|
|
|
printk(KERN_DEBUG "%d: TS_PER = %d", i, p->LayerInfo[i].TS_PER);
|
|
|
|
printk(KERN_DEBUG "%d: ErrorTSPackets = %d", i, p->LayerInfo[i].ErrorTSPackets);
|
|
|
|
printk(KERN_DEBUG "%d: TotalTSPackets = %d", i, p->LayerInfo[i].TotalTSPackets);
|
|
|
|
printk(KERN_DEBUG "%d: TILdepthI = %d", i, p->LayerInfo[i].TILdepthI);
|
|
|
|
printk(KERN_DEBUG "%d: NumberOfSegments = %d", i, p->LayerInfo[i].NumberOfSegments);
|
|
|
|
printk(KERN_DEBUG "%d: TMCCErrors = %d", i, p->LayerInfo[i].TMCCErrors);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pReceptionData->IsDemodLocked = p->IsDemodLocked;
|
|
|
|
|
|
|
|
pReceptionData->SNR = p->SNR;
|
|
|
|
pReceptionData->InBandPwr = p->InBandPwr;
|
|
|
|
|
|
|
|
pReceptionData->ErrorTSPackets = 0;
|
|
|
|
pReceptionData->BER = 0;
|
|
|
|
pReceptionData->BERErrorCount = 0;
|
|
|
|
for (i = 0; i < 3; i++) {
|
|
|
|
pReceptionData->BER += p->LayerInfo[i].BER;
|
|
|
|
pReceptionData->BERErrorCount += p->LayerInfo[i].BERErrorCount;
|
|
|
|
pReceptionData->ErrorTSPackets += p->LayerInfo[i].ErrorTSPackets;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-06-20 23:44:02 -06:00
|
|
|
static int smsdvb_onresponse(void *context, struct smscore_buffer_t *cb)
|
2008-05-19 15:56:13 -06:00
|
|
|
{
|
2008-06-15 14:52:24 -06:00
|
|
|
struct smsdvb_client_t *client = (struct smsdvb_client_t *) context;
|
2009-05-12 09:28:46 -06:00
|
|
|
struct SmsMsgHdr_ST *phdr = (struct SmsMsgHdr_ST *) (((u8 *) cb->p)
|
|
|
|
+ cb->offset);
|
|
|
|
u32 *pMsgData = (u32 *) phdr + 1;
|
|
|
|
/*u32 MsgDataLen = phdr->msgLength - sizeof(struct SmsMsgHdr_ST);*/
|
|
|
|
bool is_status_update = false;
|
2008-05-19 15:56:13 -06:00
|
|
|
|
2009-05-12 08:37:09 -06:00
|
|
|
smsendian_handle_rx_message((struct SmsMsgData_ST *) phdr);
|
|
|
|
|
2008-06-15 12:52:43 -06:00
|
|
|
switch (phdr->msgType) {
|
2008-06-15 12:14:13 -06:00
|
|
|
case MSG_SMS_DVBT_BDA_DATA:
|
|
|
|
dvb_dmx_swfilter(&client->demux, (u8 *)(phdr + 1),
|
2008-06-15 14:52:24 -06:00
|
|
|
cb->size - sizeof(struct SmsMsgHdr_ST));
|
2008-06-15 12:14:13 -06:00
|
|
|
break;
|
|
|
|
|
|
|
|
case MSG_SMS_RF_TUNE_RES:
|
2009-12-22 17:08:49 -07:00
|
|
|
case MSG_SMS_ISDBT_TUNE_RES:
|
2008-06-15 12:14:13 -06:00
|
|
|
complete(&client->tune_done);
|
|
|
|
break;
|
2008-05-19 15:56:13 -06:00
|
|
|
|
2009-05-12 09:28:46 -06:00
|
|
|
case MSG_SMS_SIGNAL_DETECTED_IND:
|
|
|
|
client->sms_stat_dvb.TransmissionData.IsDemodLocked = true;
|
|
|
|
is_status_update = true;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MSG_SMS_NO_SIGNAL_IND:
|
|
|
|
client->sms_stat_dvb.TransmissionData.IsDemodLocked = false;
|
|
|
|
is_status_update = true;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MSG_SMS_TRANSMISSION_IND: {
|
|
|
|
pMsgData++;
|
|
|
|
memcpy(&client->sms_stat_dvb.TransmissionData, pMsgData,
|
|
|
|
sizeof(struct TRANSMISSION_STATISTICS_S));
|
|
|
|
|
|
|
|
/* Mo need to correct guard interval
|
|
|
|
* (as opposed to old statistics message).
|
|
|
|
*/
|
|
|
|
CORRECT_STAT_BANDWIDTH(client->sms_stat_dvb.TransmissionData);
|
|
|
|
CORRECT_STAT_TRANSMISSON_MODE(
|
|
|
|
client->sms_stat_dvb.TransmissionData);
|
|
|
|
is_status_update = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case MSG_SMS_HO_PER_SLICES_IND: {
|
|
|
|
struct RECEPTION_STATISTICS_S *pReceptionData =
|
|
|
|
&client->sms_stat_dvb.ReceptionData;
|
|
|
|
struct SRVM_SIGNAL_STATUS_S SignalStatusData;
|
|
|
|
|
|
|
|
pMsgData++;
|
|
|
|
SignalStatusData.result = pMsgData[0];
|
|
|
|
SignalStatusData.snr = pMsgData[1];
|
|
|
|
SignalStatusData.inBandPower = (s32) pMsgData[2];
|
|
|
|
SignalStatusData.tsPackets = pMsgData[3];
|
|
|
|
SignalStatusData.etsPackets = pMsgData[4];
|
|
|
|
SignalStatusData.constellation = pMsgData[5];
|
|
|
|
SignalStatusData.hpCode = pMsgData[6];
|
|
|
|
SignalStatusData.tpsSrvIndLP = pMsgData[7] & 0x03;
|
|
|
|
SignalStatusData.tpsSrvIndHP = pMsgData[8] & 0x03;
|
|
|
|
SignalStatusData.cellId = pMsgData[9] & 0xFFFF;
|
|
|
|
SignalStatusData.reason = pMsgData[10];
|
|
|
|
SignalStatusData.requestId = pMsgData[11];
|
|
|
|
pReceptionData->IsRfLocked = pMsgData[16];
|
|
|
|
pReceptionData->IsDemodLocked = pMsgData[17];
|
|
|
|
pReceptionData->ModemState = pMsgData[12];
|
|
|
|
pReceptionData->SNR = pMsgData[1];
|
|
|
|
pReceptionData->BER = pMsgData[13];
|
|
|
|
pReceptionData->RSSI = pMsgData[14];
|
|
|
|
CORRECT_STAT_RSSI(client->sms_stat_dvb.ReceptionData);
|
|
|
|
|
|
|
|
pReceptionData->InBandPwr = (s32) pMsgData[2];
|
|
|
|
pReceptionData->CarrierOffset = (s32) pMsgData[15];
|
|
|
|
pReceptionData->TotalTSPackets = pMsgData[3];
|
|
|
|
pReceptionData->ErrorTSPackets = pMsgData[4];
|
|
|
|
|
|
|
|
/* TS PER */
|
|
|
|
if ((SignalStatusData.tsPackets + SignalStatusData.etsPackets)
|
|
|
|
> 0) {
|
|
|
|
pReceptionData->TS_PER = (SignalStatusData.etsPackets
|
|
|
|
* 100) / (SignalStatusData.tsPackets
|
|
|
|
+ SignalStatusData.etsPackets);
|
2008-06-15 12:14:13 -06:00
|
|
|
} else {
|
2009-05-12 09:28:46 -06:00
|
|
|
pReceptionData->TS_PER = 0;
|
2008-05-19 15:56:13 -06:00
|
|
|
}
|
2008-06-15 12:14:13 -06:00
|
|
|
|
2009-05-12 09:28:46 -06:00
|
|
|
pReceptionData->BERBitCount = pMsgData[18];
|
|
|
|
pReceptionData->BERErrorCount = pMsgData[19];
|
2008-05-19 15:56:13 -06:00
|
|
|
|
2009-05-12 09:28:46 -06:00
|
|
|
pReceptionData->MRC_SNR = pMsgData[20];
|
|
|
|
pReceptionData->MRC_InBandPwr = pMsgData[21];
|
|
|
|
pReceptionData->MRC_RSSI = pMsgData[22];
|
|
|
|
|
|
|
|
is_status_update = true;
|
|
|
|
break;
|
|
|
|
}
|
2009-12-23 06:07:16 -07:00
|
|
|
case MSG_SMS_GET_STATISTICS_RES: {
|
2009-12-25 07:29:42 -07:00
|
|
|
union {
|
|
|
|
struct SMSHOSTLIB_STATISTICS_ISDBT_ST isdbt;
|
|
|
|
struct SmsMsgStatisticsInfo_ST dvb;
|
|
|
|
} *p = (void *) (phdr + 1);
|
2009-12-23 06:07:16 -07:00
|
|
|
struct RECEPTION_STATISTICS_S *pReceptionData =
|
|
|
|
&client->sms_stat_dvb.ReceptionData;
|
|
|
|
|
|
|
|
is_status_update = true;
|
2009-12-25 07:29:42 -07:00
|
|
|
|
|
|
|
switch (smscore_get_device_mode(client->coredev)) {
|
|
|
|
case DEVICE_MODE_ISDBT:
|
|
|
|
case DEVICE_MODE_ISDBT_BDA:
|
|
|
|
smsdvb_update_isdbt_stats(pReceptionData, &p->isdbt);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
smsdvb_update_dvb_stats(pReceptionData, &p->dvb.Stat);
|
|
|
|
}
|
2009-12-23 06:07:16 -07:00
|
|
|
if (!pReceptionData->IsDemodLocked) {
|
|
|
|
pReceptionData->SNR = 0;
|
|
|
|
pReceptionData->BER = 0;
|
|
|
|
pReceptionData->BERErrorCount = 0;
|
|
|
|
pReceptionData->InBandPwr = 0;
|
|
|
|
pReceptionData->ErrorTSPackets = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
complete(&client->tune_done);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
2013-03-09 05:27:39 -07:00
|
|
|
sms_info("message not handled");
|
2009-05-12 09:28:46 -06:00
|
|
|
}
|
2008-05-19 15:56:13 -06:00
|
|
|
smscore_putbuffer(client->coredev, cb);
|
|
|
|
|
2009-05-12 09:28:46 -06:00
|
|
|
if (is_status_update) {
|
|
|
|
if (client->sms_stat_dvb.ReceptionData.IsDemodLocked) {
|
|
|
|
client->fe_status = FE_HAS_SIGNAL | FE_HAS_CARRIER
|
|
|
|
| FE_HAS_VITERBI | FE_HAS_SYNC | FE_HAS_LOCK;
|
|
|
|
sms_board_dvb3_event(client, DVB3_EVENT_FE_LOCK);
|
|
|
|
if (client->sms_stat_dvb.ReceptionData.ErrorTSPackets
|
|
|
|
== 0)
|
|
|
|
sms_board_dvb3_event(client, DVB3_EVENT_UNC_OK);
|
|
|
|
else
|
|
|
|
sms_board_dvb3_event(client,
|
|
|
|
DVB3_EVENT_UNC_ERR);
|
|
|
|
|
|
|
|
} else {
|
2009-12-25 14:04:17 -07:00
|
|
|
if (client->sms_stat_dvb.ReceptionData.IsRfLocked)
|
|
|
|
client->fe_status = FE_HAS_SIGNAL | FE_HAS_CARRIER;
|
|
|
|
else
|
|
|
|
client->fe_status = 0;
|
2009-05-12 09:28:46 -06:00
|
|
|
sms_board_dvb3_event(client, DVB3_EVENT_FE_UNLOCK);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-05-19 15:56:13 -06:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-06-20 23:44:02 -06:00
|
|
|
static void smsdvb_unregister_client(struct smsdvb_client_t *client)
|
2008-05-19 15:56:13 -06:00
|
|
|
{
|
2008-06-15 12:52:43 -06:00
|
|
|
/* must be called under clientslock */
|
2008-05-19 15:56:13 -06:00
|
|
|
|
|
|
|
list_del(&client->entry);
|
|
|
|
|
|
|
|
smscore_unregister_client(client->smsclient);
|
|
|
|
dvb_unregister_frontend(&client->frontend);
|
|
|
|
dvb_dmxdev_release(&client->dmxdev);
|
|
|
|
dvb_dmx_release(&client->demux);
|
|
|
|
dvb_unregister_adapter(&client->adapter);
|
|
|
|
kfree(client);
|
|
|
|
}
|
|
|
|
|
2008-06-20 23:44:02 -06:00
|
|
|
static void smsdvb_onremove(void *context)
|
2008-05-19 15:56:13 -06:00
|
|
|
{
|
|
|
|
kmutex_lock(&g_smsdvb_clientslock);
|
|
|
|
|
2008-06-15 14:52:24 -06:00
|
|
|
smsdvb_unregister_client((struct smsdvb_client_t *) context);
|
2008-05-19 15:56:13 -06:00
|
|
|
|
|
|
|
kmutex_unlock(&g_smsdvb_clientslock);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int smsdvb_start_feed(struct dvb_demux_feed *feed)
|
|
|
|
{
|
2008-06-15 14:52:24 -06:00
|
|
|
struct smsdvb_client_t *client =
|
|
|
|
container_of(feed->demux, struct smsdvb_client_t, demux);
|
|
|
|
struct SmsMsgData_ST PidMsg;
|
2008-05-19 15:56:13 -06:00
|
|
|
|
2008-06-19 17:35:21 -06:00
|
|
|
sms_debug("add pid %d(%x)",
|
2008-06-18 22:15:46 -06:00
|
|
|
feed->pid, feed->pid);
|
2008-05-19 15:56:13 -06:00
|
|
|
|
|
|
|
PidMsg.xMsgHeader.msgSrcId = DVBT_BDA_CONTROL_MSG_ID;
|
|
|
|
PidMsg.xMsgHeader.msgDstId = HIF_TASK;
|
|
|
|
PidMsg.xMsgHeader.msgFlags = 0;
|
|
|
|
PidMsg.xMsgHeader.msgType = MSG_SMS_ADD_PID_FILTER_REQ;
|
|
|
|
PidMsg.xMsgHeader.msgLength = sizeof(PidMsg);
|
|
|
|
PidMsg.msgData[0] = feed->pid;
|
|
|
|
|
2009-05-12 08:37:09 -06:00
|
|
|
smsendian_handle_tx_message((struct SmsMsgHdr_ST *)&PidMsg);
|
2008-06-15 12:14:13 -06:00
|
|
|
return smsclient_sendrequest(client->smsclient,
|
|
|
|
&PidMsg, sizeof(PidMsg));
|
2008-05-19 15:56:13 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
static int smsdvb_stop_feed(struct dvb_demux_feed *feed)
|
|
|
|
{
|
2008-06-15 14:52:24 -06:00
|
|
|
struct smsdvb_client_t *client =
|
|
|
|
container_of(feed->demux, struct smsdvb_client_t, demux);
|
|
|
|
struct SmsMsgData_ST PidMsg;
|
2008-05-19 15:56:13 -06:00
|
|
|
|
2008-06-19 17:35:21 -06:00
|
|
|
sms_debug("remove pid %d(%x)",
|
2008-06-18 22:15:46 -06:00
|
|
|
feed->pid, feed->pid);
|
2008-05-19 15:56:13 -06:00
|
|
|
|
|
|
|
PidMsg.xMsgHeader.msgSrcId = DVBT_BDA_CONTROL_MSG_ID;
|
|
|
|
PidMsg.xMsgHeader.msgDstId = HIF_TASK;
|
|
|
|
PidMsg.xMsgHeader.msgFlags = 0;
|
|
|
|
PidMsg.xMsgHeader.msgType = MSG_SMS_REMOVE_PID_FILTER_REQ;
|
|
|
|
PidMsg.xMsgHeader.msgLength = sizeof(PidMsg);
|
|
|
|
PidMsg.msgData[0] = feed->pid;
|
|
|
|
|
2009-05-12 08:37:09 -06:00
|
|
|
smsendian_handle_tx_message((struct SmsMsgHdr_ST *)&PidMsg);
|
2008-06-15 12:14:13 -06:00
|
|
|
return smsclient_sendrequest(client->smsclient,
|
|
|
|
&PidMsg, sizeof(PidMsg));
|
2008-05-19 15:56:13 -06:00
|
|
|
}
|
|
|
|
|
2008-06-15 14:52:24 -06:00
|
|
|
static int smsdvb_sendrequest_and_wait(struct smsdvb_client_t *client,
|
2008-05-06 00:11:51 -06:00
|
|
|
void *buffer, size_t size,
|
|
|
|
struct completion *completion)
|
2008-05-19 15:56:13 -06:00
|
|
|
{
|
2009-05-12 08:37:09 -06:00
|
|
|
int rc;
|
|
|
|
|
|
|
|
smsendian_handle_tx_message((struct SmsMsgHdr_ST *)buffer);
|
|
|
|
rc = smsclient_sendrequest(client->smsclient, buffer, size);
|
2008-05-19 15:56:13 -06:00
|
|
|
if (rc < 0)
|
|
|
|
return rc;
|
|
|
|
|
2008-06-15 12:14:13 -06:00
|
|
|
return wait_for_completion_timeout(completion,
|
|
|
|
msecs_to_jiffies(2000)) ?
|
|
|
|
0 : -ETIME;
|
2008-05-19 15:56:13 -06:00
|
|
|
}
|
|
|
|
|
2009-12-23 06:07:16 -07:00
|
|
|
static int smsdvb_send_statistics_request(struct smsdvb_client_t *client)
|
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
struct SmsMsgHdr_ST Msg = { MSG_SMS_GET_STATISTICS_REQ,
|
|
|
|
DVBT_BDA_CONTROL_MSG_ID,
|
|
|
|
HIF_TASK,
|
|
|
|
sizeof(struct SmsMsgHdr_ST), 0 };
|
|
|
|
|
|
|
|
rc = smsdvb_sendrequest_and_wait(client, &Msg, sizeof(Msg),
|
|
|
|
&client->tune_done);
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2009-07-12 20:30:14 -06:00
|
|
|
static inline int led_feedback(struct smsdvb_client_t *client)
|
|
|
|
{
|
|
|
|
if (client->fe_status & FE_HAS_LOCK)
|
|
|
|
return sms_board_led_feedback(client->coredev,
|
|
|
|
(client->sms_stat_dvb.ReceptionData.BER
|
|
|
|
== 0) ? SMS_LED_HI : SMS_LED_LO);
|
|
|
|
else
|
|
|
|
return sms_board_led_feedback(client->coredev, SMS_LED_OFF);
|
|
|
|
}
|
|
|
|
|
2008-05-19 15:56:13 -06:00
|
|
|
static int smsdvb_read_status(struct dvb_frontend *fe, fe_status_t *stat)
|
|
|
|
{
|
2009-12-23 06:07:16 -07:00
|
|
|
int rc;
|
2009-05-12 09:28:46 -06:00
|
|
|
struct smsdvb_client_t *client;
|
|
|
|
client = container_of(fe, struct smsdvb_client_t, frontend);
|
2008-05-19 15:56:13 -06:00
|
|
|
|
2009-12-23 06:07:16 -07:00
|
|
|
rc = smsdvb_send_statistics_request(client);
|
|
|
|
|
2009-05-12 09:28:46 -06:00
|
|
|
*stat = client->fe_status;
|
2008-05-19 15:56:13 -06:00
|
|
|
|
2009-07-12 20:30:14 -06:00
|
|
|
led_feedback(client);
|
|
|
|
|
2009-12-23 06:07:16 -07:00
|
|
|
return rc;
|
2008-05-19 15:56:13 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
static int smsdvb_read_ber(struct dvb_frontend *fe, u32 *ber)
|
|
|
|
{
|
2009-12-23 06:07:16 -07:00
|
|
|
int rc;
|
2009-05-12 09:28:46 -06:00
|
|
|
struct smsdvb_client_t *client;
|
|
|
|
client = container_of(fe, struct smsdvb_client_t, frontend);
|
2008-05-19 15:56:13 -06:00
|
|
|
|
2009-12-23 06:07:16 -07:00
|
|
|
rc = smsdvb_send_statistics_request(client);
|
|
|
|
|
2009-05-12 09:28:46 -06:00
|
|
|
*ber = client->sms_stat_dvb.ReceptionData.BER;
|
2008-05-19 15:56:13 -06:00
|
|
|
|
2009-07-12 20:30:14 -06:00
|
|
|
led_feedback(client);
|
|
|
|
|
2009-12-23 06:07:16 -07:00
|
|
|
return rc;
|
2008-05-19 15:56:13 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
static int smsdvb_read_signal_strength(struct dvb_frontend *fe, u16 *strength)
|
|
|
|
{
|
2009-12-23 06:07:16 -07:00
|
|
|
int rc;
|
|
|
|
|
2009-05-12 09:28:46 -06:00
|
|
|
struct smsdvb_client_t *client;
|
|
|
|
client = container_of(fe, struct smsdvb_client_t, frontend);
|
2008-05-19 15:56:13 -06:00
|
|
|
|
2009-12-23 06:07:16 -07:00
|
|
|
rc = smsdvb_send_statistics_request(client);
|
|
|
|
|
2009-05-12 09:28:46 -06:00
|
|
|
if (client->sms_stat_dvb.ReceptionData.InBandPwr < -95)
|
|
|
|
*strength = 0;
|
|
|
|
else if (client->sms_stat_dvb.ReceptionData.InBandPwr > -29)
|
|
|
|
*strength = 100;
|
|
|
|
else
|
|
|
|
*strength =
|
|
|
|
(client->sms_stat_dvb.ReceptionData.InBandPwr
|
|
|
|
+ 95) * 3 / 2;
|
2008-05-19 15:56:13 -06:00
|
|
|
|
2009-07-12 20:30:14 -06:00
|
|
|
led_feedback(client);
|
|
|
|
|
2009-12-23 06:07:16 -07:00
|
|
|
return rc;
|
2008-05-19 15:56:13 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
static int smsdvb_read_snr(struct dvb_frontend *fe, u16 *snr)
|
|
|
|
{
|
2009-12-23 06:07:16 -07:00
|
|
|
int rc;
|
2009-05-12 09:28:46 -06:00
|
|
|
struct smsdvb_client_t *client;
|
|
|
|
client = container_of(fe, struct smsdvb_client_t, frontend);
|
2008-05-19 15:56:13 -06:00
|
|
|
|
2009-12-23 06:07:16 -07:00
|
|
|
rc = smsdvb_send_statistics_request(client);
|
|
|
|
|
2009-05-12 09:28:46 -06:00
|
|
|
*snr = client->sms_stat_dvb.ReceptionData.SNR;
|
2008-05-19 15:56:13 -06:00
|
|
|
|
2009-07-12 20:30:14 -06:00
|
|
|
led_feedback(client);
|
|
|
|
|
2009-12-23 06:07:16 -07:00
|
|
|
return rc;
|
2008-05-19 15:56:13 -06:00
|
|
|
}
|
|
|
|
|
2008-11-22 10:56:37 -07:00
|
|
|
static int smsdvb_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks)
|
|
|
|
{
|
2009-12-23 06:07:16 -07:00
|
|
|
int rc;
|
2009-05-12 09:28:46 -06:00
|
|
|
struct smsdvb_client_t *client;
|
|
|
|
client = container_of(fe, struct smsdvb_client_t, frontend);
|
2008-11-22 10:56:37 -07:00
|
|
|
|
2009-12-23 06:07:16 -07:00
|
|
|
rc = smsdvb_send_statistics_request(client);
|
|
|
|
|
2009-05-12 09:28:46 -06:00
|
|
|
*ucblocks = client->sms_stat_dvb.ReceptionData.ErrorTSPackets;
|
2008-11-22 10:56:37 -07:00
|
|
|
|
2009-07-12 20:30:14 -06:00
|
|
|
led_feedback(client);
|
|
|
|
|
2009-12-23 06:07:16 -07:00
|
|
|
return rc;
|
2008-11-22 10:56:37 -07:00
|
|
|
}
|
|
|
|
|
2008-06-15 12:14:13 -06:00
|
|
|
static int smsdvb_get_tune_settings(struct dvb_frontend *fe,
|
|
|
|
struct dvb_frontend_tune_settings *tune)
|
2008-05-19 15:56:13 -06:00
|
|
|
{
|
2008-06-19 17:35:21 -06:00
|
|
|
sms_debug("");
|
2008-05-19 15:56:13 -06:00
|
|
|
|
|
|
|
tune->min_delay_ms = 400;
|
|
|
|
tune->step_size = 250000;
|
|
|
|
tune->max_drift = 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-12-26 12:31:29 -07:00
|
|
|
static int smsdvb_dvbt_set_frontend(struct dvb_frontend *fe)
|
2008-05-19 15:56:13 -06:00
|
|
|
{
|
2009-12-23 07:28:46 -07:00
|
|
|
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
|
2008-06-15 14:52:24 -06:00
|
|
|
struct smsdvb_client_t *client =
|
|
|
|
container_of(fe, struct smsdvb_client_t, frontend);
|
2008-05-19 15:56:13 -06:00
|
|
|
|
2008-06-15 14:52:24 -06:00
|
|
|
struct {
|
|
|
|
struct SmsMsgHdr_ST Msg;
|
2008-06-15 12:14:13 -06:00
|
|
|
u32 Data[3];
|
2008-05-19 15:56:13 -06:00
|
|
|
} Msg;
|
|
|
|
|
2009-07-12 20:30:14 -06:00
|
|
|
int ret;
|
|
|
|
|
2009-05-12 09:28:46 -06:00
|
|
|
client->fe_status = FE_HAS_SIGNAL;
|
|
|
|
client->event_fe_state = -1;
|
|
|
|
client->event_unc_state = -1;
|
2009-12-25 03:17:03 -07:00
|
|
|
fe->dtv_property_cache.delivery_system = SYS_DVBT;
|
2009-05-12 09:28:46 -06:00
|
|
|
|
|
|
|
Msg.Msg.msgSrcId = DVBT_BDA_CONTROL_MSG_ID;
|
|
|
|
Msg.Msg.msgDstId = HIF_TASK;
|
|
|
|
Msg.Msg.msgFlags = 0;
|
|
|
|
Msg.Msg.msgType = MSG_SMS_RF_TUNE_REQ;
|
2008-05-19 15:56:13 -06:00
|
|
|
Msg.Msg.msgLength = sizeof(Msg);
|
2009-12-23 07:28:46 -07:00
|
|
|
Msg.Data[0] = c->frequency;
|
2008-05-19 15:56:13 -06:00
|
|
|
Msg.Data[2] = 12000000;
|
|
|
|
|
2009-12-23 07:28:46 -07:00
|
|
|
sms_info("%s: freq %d band %d", __func__, c->frequency,
|
|
|
|
c->bandwidth_hz);
|
2008-05-19 15:56:13 -06:00
|
|
|
|
2009-12-25 03:29:06 -07:00
|
|
|
switch (c->bandwidth_hz / 1000000) {
|
2009-12-23 07:28:46 -07:00
|
|
|
case 8:
|
|
|
|
Msg.Data[1] = BW_8_MHZ;
|
|
|
|
break;
|
|
|
|
case 7:
|
|
|
|
Msg.Data[1] = BW_7_MHZ;
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
Msg.Data[1] = BW_6_MHZ;
|
|
|
|
break;
|
|
|
|
case 0:
|
|
|
|
return -EOPNOTSUPP;
|
|
|
|
default:
|
|
|
|
return -EINVAL;
|
2008-05-19 15:56:13 -06:00
|
|
|
}
|
2009-07-12 20:30:14 -06: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 */
|
|
|
|
ret = smsdvb_sendrequest_and_wait(client, &Msg, sizeof(Msg),
|
|
|
|
&client->tune_done);
|
|
|
|
|
|
|
|
smsdvb_read_status(fe, &status);
|
|
|
|
|
|
|
|
if (status & FE_HAS_LOCK)
|
|
|
|
return ret;
|
|
|
|
|
2011-03-30 19:57:33 -06:00
|
|
|
/* previous tune didn't lock - enable LNA and tune again */
|
2009-07-12 20:30:14 -06:00
|
|
|
sms_board_lna_control(client->coredev, 1);
|
|
|
|
}
|
2008-05-19 15:56:13 -06:00
|
|
|
|
2008-06-15 12:14:13 -06:00
|
|
|
return smsdvb_sendrequest_and_wait(client, &Msg, sizeof(Msg),
|
|
|
|
&client->tune_done);
|
2008-05-19 15:56:13 -06:00
|
|
|
}
|
|
|
|
|
2011-12-26 12:31:29 -07:00
|
|
|
static int smsdvb_isdbt_set_frontend(struct dvb_frontend *fe)
|
2009-12-22 17:08:49 -07:00
|
|
|
{
|
2009-12-23 07:28:46 -07:00
|
|
|
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
|
2009-12-22 17:08:49 -07:00
|
|
|
struct smsdvb_client_t *client =
|
|
|
|
container_of(fe, struct smsdvb_client_t, frontend);
|
|
|
|
|
|
|
|
struct {
|
|
|
|
struct SmsMsgHdr_ST Msg;
|
|
|
|
u32 Data[4];
|
|
|
|
} Msg;
|
|
|
|
|
2009-12-25 03:17:03 -07:00
|
|
|
fe->dtv_property_cache.delivery_system = SYS_ISDBT;
|
|
|
|
|
2009-12-22 17:08:49 -07:00
|
|
|
Msg.Msg.msgSrcId = DVBT_BDA_CONTROL_MSG_ID;
|
|
|
|
Msg.Msg.msgDstId = HIF_TASK;
|
|
|
|
Msg.Msg.msgFlags = 0;
|
|
|
|
Msg.Msg.msgType = MSG_SMS_ISDBT_TUNE_REQ;
|
|
|
|
Msg.Msg.msgLength = sizeof(Msg);
|
|
|
|
|
2009-12-23 07:28:46 -07:00
|
|
|
if (c->isdbt_sb_segment_idx == -1)
|
|
|
|
c->isdbt_sb_segment_idx = 0;
|
2009-12-22 17:08:49 -07:00
|
|
|
|
2009-12-23 07:28:46 -07:00
|
|
|
switch (c->isdbt_sb_segment_count) {
|
|
|
|
case 3:
|
2009-12-22 17:08:49 -07:00
|
|
|
Msg.Data[1] = BW_ISDBT_3SEG;
|
|
|
|
break;
|
2009-12-23 07:28:46 -07:00
|
|
|
case 1:
|
2009-12-22 17:08:49 -07:00
|
|
|
Msg.Data[1] = BW_ISDBT_1SEG;
|
|
|
|
break;
|
2009-12-23 07:28:46 -07:00
|
|
|
case 0: /* AUTO */
|
2009-12-25 03:29:06 -07:00
|
|
|
switch (c->bandwidth_hz / 1000000) {
|
2009-12-23 07:28:46 -07:00
|
|
|
case 8:
|
|
|
|
case 7:
|
|
|
|
c->isdbt_sb_segment_count = 3;
|
|
|
|
Msg.Data[1] = BW_ISDBT_3SEG;
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
c->isdbt_sb_segment_count = 1;
|
|
|
|
Msg.Data[1] = BW_ISDBT_1SEG;
|
|
|
|
break;
|
|
|
|
default: /* Assumes 6 MHZ bw */
|
|
|
|
c->isdbt_sb_segment_count = 1;
|
|
|
|
c->bandwidth_hz = 6000;
|
|
|
|
Msg.Data[1] = BW_ISDBT_1SEG;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
2009-12-22 17:08:49 -07:00
|
|
|
default:
|
2009-12-23 07:28:46 -07:00
|
|
|
sms_info("Segment count %d not supported", c->isdbt_sb_segment_count);
|
2009-12-22 17:08:49 -07:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
2009-12-23 07:28:46 -07:00
|
|
|
Msg.Data[0] = c->frequency;
|
|
|
|
Msg.Data[2] = 12000000;
|
|
|
|
Msg.Data[3] = c->isdbt_sb_segment_idx;
|
|
|
|
|
|
|
|
sms_info("%s: freq %d segwidth %d segindex %d\n", __func__,
|
|
|
|
c->frequency, c->isdbt_sb_segment_count,
|
|
|
|
c->isdbt_sb_segment_idx);
|
|
|
|
|
2009-12-22 17:08:49 -07:00
|
|
|
return smsdvb_sendrequest_and_wait(client, &Msg, sizeof(Msg),
|
|
|
|
&client->tune_done);
|
|
|
|
}
|
|
|
|
|
2011-12-26 12:31:29 -07:00
|
|
|
static int smsdvb_set_frontend(struct dvb_frontend *fe)
|
2009-12-22 17:08:49 -07:00
|
|
|
{
|
|
|
|
struct smsdvb_client_t *client =
|
|
|
|
container_of(fe, struct smsdvb_client_t, frontend);
|
|
|
|
struct smscore_device_t *coredev = client->coredev;
|
|
|
|
|
|
|
|
switch (smscore_get_device_mode(coredev)) {
|
|
|
|
case DEVICE_MODE_DVBT:
|
|
|
|
case DEVICE_MODE_DVBT_BDA:
|
2011-12-26 12:31:29 -07:00
|
|
|
return smsdvb_dvbt_set_frontend(fe);
|
2009-12-22 17:08:49 -07:00
|
|
|
case DEVICE_MODE_ISDBT:
|
|
|
|
case DEVICE_MODE_ISDBT_BDA:
|
2011-12-26 12:31:29 -07:00
|
|
|
return smsdvb_isdbt_set_frontend(fe);
|
2009-12-22 17:08:49 -07:00
|
|
|
default:
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
[media] dvb: don't require a parameter for get_frontend
Just like set_frontend, use the dvb cache properties for get_frontend.
This is more consistent, as both functions are now symetric. Also,
at the places get_frontend is called, it makes sense to update the
cache.
Most of this patch were generated by this small perl script:
while (<>) { $file .= $_; }
if ($file =~ m/\.get_frontend\s*=\s*([\d\w_]+)/) {
my $get = $1;
$file =~ s/($get)(\s*\([^\,\)]+)\,\s*struct\s+dtv_frontend_properties\s*\*\s*([_\d\w]+)\)\s*\{/\1\2)\n{\n\tstruct dtv_frontend_properties *\3 = &fe->dtv_property_cache;/g;
}
print $file;
Of course, the changes at dvb_frontend.[ch] were made by hand,
as well as the changes on a few other places, where get_frontend()
is called internally inside the driver.
On some places, get_frontend() were just a void function. Those
occurrences were removed, as the DVB core handles such cases.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-12-30 07:30:21 -07:00
|
|
|
static int smsdvb_get_frontend(struct dvb_frontend *fe)
|
2008-05-19 15:56:13 -06:00
|
|
|
{
|
[media] dvb: don't require a parameter for get_frontend
Just like set_frontend, use the dvb cache properties for get_frontend.
This is more consistent, as both functions are now symetric. Also,
at the places get_frontend is called, it makes sense to update the
cache.
Most of this patch were generated by this small perl script:
while (<>) { $file .= $_; }
if ($file =~ m/\.get_frontend\s*=\s*([\d\w_]+)/) {
my $get = $1;
$file =~ s/($get)(\s*\([^\,\)]+)\,\s*struct\s+dtv_frontend_properties\s*\*\s*([_\d\w]+)\)\s*\{/\1\2)\n{\n\tstruct dtv_frontend_properties *\3 = &fe->dtv_property_cache;/g;
}
print $file;
Of course, the changes at dvb_frontend.[ch] were made by hand,
as well as the changes on a few other places, where get_frontend()
is called internally inside the driver.
On some places, get_frontend() were just a void function. Those
occurrences were removed, as the DVB core handles such cases.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-12-30 07:30:21 -07:00
|
|
|
struct dtv_frontend_properties *fep = &fe->dtv_property_cache;
|
2008-06-15 14:52:24 -06:00
|
|
|
struct smsdvb_client_t *client =
|
|
|
|
container_of(fe, struct smsdvb_client_t, frontend);
|
2012-02-20 03:50:33 -07:00
|
|
|
struct smscore_device_t *coredev = client->coredev;
|
|
|
|
struct TRANSMISSION_STATISTICS_S *td =
|
|
|
|
&client->sms_stat_dvb.TransmissionData;
|
2008-05-19 15:56:13 -06:00
|
|
|
|
2012-02-20 03:50:33 -07:00
|
|
|
switch (smscore_get_device_mode(coredev)) {
|
|
|
|
case DEVICE_MODE_DVBT:
|
|
|
|
case DEVICE_MODE_DVBT_BDA:
|
|
|
|
fep->frequency = td->Frequency;
|
|
|
|
|
|
|
|
switch (td->Bandwidth) {
|
|
|
|
case 6:
|
|
|
|
fep->bandwidth_hz = 6000000;
|
|
|
|
break;
|
|
|
|
case 7:
|
|
|
|
fep->bandwidth_hz = 7000000;
|
|
|
|
break;
|
|
|
|
case 8:
|
|
|
|
fep->bandwidth_hz = 8000000;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (td->TransmissionMode) {
|
|
|
|
case 2:
|
|
|
|
fep->transmission_mode = TRANSMISSION_MODE_2K;
|
|
|
|
break;
|
|
|
|
case 8:
|
|
|
|
fep->transmission_mode = TRANSMISSION_MODE_8K;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (td->GuardInterval) {
|
|
|
|
case 0:
|
|
|
|
fep->guard_interval = GUARD_INTERVAL_1_32;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
fep->guard_interval = GUARD_INTERVAL_1_16;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
fep->guard_interval = GUARD_INTERVAL_1_8;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
fep->guard_interval = GUARD_INTERVAL_1_4;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (td->CodeRate) {
|
|
|
|
case 0:
|
|
|
|
fep->code_rate_HP = FEC_1_2;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
fep->code_rate_HP = FEC_2_3;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
fep->code_rate_HP = FEC_3_4;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
fep->code_rate_HP = FEC_5_6;
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
fep->code_rate_HP = FEC_7_8;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (td->LPCodeRate) {
|
|
|
|
case 0:
|
|
|
|
fep->code_rate_LP = FEC_1_2;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
fep->code_rate_LP = FEC_2_3;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
fep->code_rate_LP = FEC_3_4;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
fep->code_rate_LP = FEC_5_6;
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
fep->code_rate_LP = FEC_7_8;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (td->Constellation) {
|
|
|
|
case 0:
|
|
|
|
fep->modulation = QPSK;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
fep->modulation = QAM_16;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
fep->modulation = QAM_64;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (td->Hierarchy) {
|
|
|
|
case 0:
|
|
|
|
fep->hierarchy = HIERARCHY_NONE;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
fep->hierarchy = HIERARCHY_1;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
fep->hierarchy = HIERARCHY_2;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
fep->hierarchy = HIERARCHY_4;
|
|
|
|
break;
|
|
|
|
}
|
2008-05-19 15:56:13 -06:00
|
|
|
|
2012-02-20 03:50:33 -07:00
|
|
|
fep->inversion = INVERSION_AUTO;
|
|
|
|
break;
|
|
|
|
case DEVICE_MODE_ISDBT:
|
|
|
|
case DEVICE_MODE_ISDBT_BDA:
|
|
|
|
fep->frequency = td->Frequency;
|
|
|
|
fep->bandwidth_hz = 6000000;
|
|
|
|
/* todo: retrive the other parameters */
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
2008-11-22 10:26:37 -07:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int smsdvb_init(struct dvb_frontend *fe)
|
|
|
|
{
|
|
|
|
struct smsdvb_client_t *client =
|
|
|
|
container_of(fe, struct smsdvb_client_t, frontend);
|
|
|
|
|
2009-07-12 20:30:14 -06:00
|
|
|
sms_board_power(client->coredev, 1);
|
|
|
|
|
2009-05-12 09:28:46 -06:00
|
|
|
sms_board_dvb3_event(client, DVB3_EVENT_INIT);
|
2008-11-22 10:26:37 -07: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-12 20:30:14 -06:00
|
|
|
sms_board_led_feedback(client->coredev, SMS_LED_OFF);
|
|
|
|
sms_board_power(client->coredev, 0);
|
|
|
|
|
2009-05-12 09:28:46 -06:00
|
|
|
sms_board_dvb3_event(client, DVB3_EVENT_SLEEP);
|
2008-11-22 10:26:37 -07:00
|
|
|
|
2008-05-19 15:56:13 -06:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void smsdvb_release(struct dvb_frontend *fe)
|
|
|
|
{
|
2008-06-15 12:52:43 -06:00
|
|
|
/* do nothing */
|
2008-05-19 15:56:13 -06: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-30 21:44:04 -06:00
|
|
|
.name = "Siano Mobile Digital MDTV Receiver",
|
2008-05-19 15:56:13 -06:00
|
|
|
.frequency_min = 44250000,
|
|
|
|
.frequency_max = 867250000,
|
|
|
|
.frequency_stepsize = 250000,
|
|
|
|
.caps = FE_CAN_INVERSION_AUTO |
|
2008-06-15 12:14:13 -06: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-19 15:56:13 -06:00
|
|
|
},
|
|
|
|
|
|
|
|
.release = smsdvb_release,
|
|
|
|
|
2011-12-26 12:31:29 -07:00
|
|
|
.set_frontend = smsdvb_set_frontend,
|
|
|
|
.get_frontend = smsdvb_get_frontend,
|
2008-05-19 15:56:13 -06: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-22 10:56:37 -07:00
|
|
|
.read_ucblocks = smsdvb_read_ucblocks,
|
2008-11-22 10:26:37 -07:00
|
|
|
|
|
|
|
.init = smsdvb_init,
|
|
|
|
.sleep = smsdvb_sleep,
|
2008-05-19 15:56:13 -06:00
|
|
|
};
|
|
|
|
|
2008-06-20 23:44:02 -06:00
|
|
|
static int smsdvb_hotplug(struct smscore_device_t *coredev,
|
|
|
|
struct device *device, int arrival)
|
2008-05-19 15:56:13 -06:00
|
|
|
{
|
2008-06-15 14:52:24 -06:00
|
|
|
struct smsclient_params_t params;
|
|
|
|
struct smsdvb_client_t *client;
|
2008-05-19 15:56:13 -06:00
|
|
|
int rc;
|
|
|
|
|
2008-06-15 12:52:43 -06:00
|
|
|
/* device removal handled by onremove callback */
|
2008-05-19 15:56:13 -06:00
|
|
|
if (!arrival)
|
|
|
|
return 0;
|
2008-06-15 14:52:24 -06:00
|
|
|
client = kzalloc(sizeof(struct smsdvb_client_t), GFP_KERNEL);
|
2008-06-15 12:14:13 -06:00
|
|
|
if (!client) {
|
2008-06-19 19:07:23 -06:00
|
|
|
sms_err("kmalloc() failed");
|
2008-05-19 15:56:13 -06:00
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
|
2008-06-15 12:52:43 -06:00
|
|
|
/* register dvb adapter */
|
2008-06-18 19:09:55 -06:00
|
|
|
rc = dvb_register_adapter(&client->adapter,
|
|
|
|
sms_get_board(
|
|
|
|
smscore_get_board_id(coredev))->name,
|
2008-06-15 12:14:13 -06:00
|
|
|
THIS_MODULE, device, adapter_nr);
|
|
|
|
if (rc < 0) {
|
2008-06-19 17:35:21 -06:00
|
|
|
sms_err("dvb_register_adapter() failed %d", rc);
|
2008-05-19 15:56:13 -06:00
|
|
|
goto adapter_error;
|
|
|
|
}
|
|
|
|
|
2008-06-15 12:52:43 -06:00
|
|
|
/* init dvb demux */
|
2008-05-19 15:56:13 -06:00
|
|
|
client->demux.dmx.capabilities = DMX_TS_FILTERING;
|
2008-06-15 12:52:43 -06:00
|
|
|
client->demux.filternum = 32; /* todo: nova ??? */
|
2008-05-19 15:56:13 -06: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-15 12:14:13 -06:00
|
|
|
if (rc < 0) {
|
2008-06-19 17:35:21 -06:00
|
|
|
sms_err("dvb_dmx_init failed %d", rc);
|
2008-05-19 15:56:13 -06:00
|
|
|
goto dvbdmx_error;
|
|
|
|
}
|
|
|
|
|
2008-06-15 12:52:43 -06:00
|
|
|
/* init dmxdev */
|
2008-05-19 15:56:13 -06: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-15 12:14:13 -06:00
|
|
|
if (rc < 0) {
|
2008-06-19 17:35:21 -06:00
|
|
|
sms_err("dvb_dmxdev_init failed %d", rc);
|
2008-05-19 15:56:13 -06:00
|
|
|
goto dmxdev_error;
|
|
|
|
}
|
|
|
|
|
2008-06-15 12:52:43 -06:00
|
|
|
/* init and register frontend */
|
2008-06-15 12:14:13 -06:00
|
|
|
memcpy(&client->frontend.ops, &smsdvb_fe_ops,
|
|
|
|
sizeof(struct dvb_frontend_ops));
|
2008-05-19 15:56:13 -06:00
|
|
|
|
2011-12-26 12:31:29 -07:00
|
|
|
switch (smscore_get_device_mode(coredev)) {
|
|
|
|
case DEVICE_MODE_DVBT:
|
|
|
|
case DEVICE_MODE_DVBT_BDA:
|
2012-03-01 03:25:39 -07:00
|
|
|
client->frontend.ops.delsys[0] = SYS_DVBT;
|
2011-12-26 12:31:29 -07:00
|
|
|
break;
|
|
|
|
case DEVICE_MODE_ISDBT:
|
|
|
|
case DEVICE_MODE_ISDBT_BDA:
|
2012-03-01 03:25:39 -07:00
|
|
|
client->frontend.ops.delsys[0] = SYS_ISDBT;
|
2011-12-26 12:31:29 -07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2008-05-19 15:56:13 -06:00
|
|
|
rc = dvb_register_frontend(&client->adapter, &client->frontend);
|
2008-06-15 12:14:13 -06:00
|
|
|
if (rc < 0) {
|
2008-06-19 17:35:21 -06:00
|
|
|
sms_err("frontend registration failed %d", rc);
|
2008-05-19 15:56:13 -06:00
|
|
|
goto frontend_error;
|
|
|
|
}
|
|
|
|
|
2008-06-13 21:43:26 -06:00
|
|
|
params.initial_id = 1;
|
2008-05-19 15:56:13 -06: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-15 12:14:13 -06:00
|
|
|
if (rc < 0) {
|
2008-06-19 19:07:23 -06:00
|
|
|
sms_err("smscore_register_client() failed %d", rc);
|
2008-05-19 15:56:13 -06:00
|
|
|
goto client_error;
|
|
|
|
}
|
|
|
|
|
|
|
|
client->coredev = coredev;
|
|
|
|
|
|
|
|
init_completion(&client->tune_done);
|
|
|
|
|
|
|
|
kmutex_lock(&g_smsdvb_clientslock);
|
|
|
|
|
|
|
|
list_add(&client->entry, &g_smsdvb_clients);
|
|
|
|
|
|
|
|
kmutex_unlock(&g_smsdvb_clientslock);
|
|
|
|
|
2009-05-12 09:28:46 -06:00
|
|
|
client->event_fe_state = -1;
|
|
|
|
client->event_unc_state = -1;
|
|
|
|
sms_board_dvb3_event(client, DVB3_EVENT_HOTPLUG);
|
2008-05-19 15:56:13 -06:00
|
|
|
|
2009-05-12 09:28:46 -06:00
|
|
|
sms_info("success");
|
2008-11-16 18:45:42 -07:00
|
|
|
sms_board_setup(coredev);
|
|
|
|
|
2008-05-19 15:56:13 -06: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:
|
|
|
|
dvb_unregister_adapter(&client->adapter);
|
|
|
|
|
|
|
|
adapter_error:
|
|
|
|
kfree(client);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2009-12-11 16:05:10 -07:00
|
|
|
static int __init smsdvb_module_init(void)
|
2008-05-22 15:04:36 -06:00
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
INIT_LIST_HEAD(&g_smsdvb_clients);
|
|
|
|
kmutex_init(&g_smsdvb_clientslock);
|
|
|
|
|
|
|
|
rc = smscore_register_hotplug(smsdvb_hotplug);
|
|
|
|
|
2008-06-19 17:35:21 -06:00
|
|
|
sms_debug("");
|
2008-05-22 15:04:36 -06:00
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2009-12-11 16:05:10 -07:00
|
|
|
static void __exit smsdvb_module_exit(void)
|
2008-05-22 15:04:36 -06:00
|
|
|
{
|
|
|
|
smscore_unregister_hotplug(smsdvb_hotplug);
|
|
|
|
|
|
|
|
kmutex_lock(&g_smsdvb_clientslock);
|
|
|
|
|
|
|
|
while (!list_empty(&g_smsdvb_clients))
|
2008-06-15 12:14:13 -06:00
|
|
|
smsdvb_unregister_client(
|
2008-06-15 14:52:24 -06:00
|
|
|
(struct smsdvb_client_t *) g_smsdvb_clients.next);
|
2008-05-22 15:04:36 -06: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-30 21:44:04 -06:00
|
|
|
|
|
|
|
module_init(smsdvb_module_init);
|
|
|
|
module_exit(smsdvb_module_exit);
|
|
|
|
|
|
|
|
MODULE_DESCRIPTION("SMS DVB subsystem adaptation module");
|
2009-05-12 10:13:13 -06: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-30 21:44:04 -06:00
|
|
|
MODULE_LICENSE("GPL");
|