Example #1
0
static int smsdvb_tune_dvbt(struct smsdvb_client_t *client, 
			     struct dvb_frontend_parameters *fep)
{
	struct {
		struct SmsMsgHdr_ST Msg;
		u32 Data[3];
	} Msg;

	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;
	Msg.Msg.msgLength = sizeof(Msg);
	Msg.Data[0] = fep->frequency;
	Msg.Data[2] = 12000000;

	sms_debug("freq %d band %d",
		  fep->frequency, fep->u.ofdm.bandwidth);

	switch (fep->u.ofdm.bandwidth) {
	case BANDWIDTH_8_MHZ:
		Msg.Data[1] = BW_8_MHZ;
		break;
	case BANDWIDTH_7_MHZ:
		Msg.Data[1] = BW_7_MHZ;
		break;
	case BANDWIDTH_6_MHZ:
		Msg.Data[1] = BW_6_MHZ;
		break;
#if 0
	case BANDWIDTH_5_MHZ:
		Msg.Data[1] = BW_5_MHZ;
		break;
#endif
	case BANDWIDTH_AUTO:
		return -EOPNOTSUPP;
	default:
		return -EINVAL;
	}

	return smsdvb_sendrequest_and_wait(client, &Msg, sizeof(Msg),
					   &client->tune_done);
	
}
Example #2
0
static int smsdvb_get_statistics_ex(struct dvb_frontend *fe) {

	struct smsdvb_client_t *client =
	    container_of(fe, struct smsdvb_client_t, frontend);

	struct {
		struct SmsMsgHdr_ST Msg;
	} Msg;

	Msg.Msg.msgSrcId = DVBT_BDA_CONTROL_MSG_ID;
	Msg.Msg.msgDstId = HIF_TASK;
	Msg.Msg.msgFlags = 0;
	Msg.Msg.msgType = MSG_SMS_GET_STATISTICS_EX_REQ;
	Msg.Msg.msgLength = sizeof(Msg);

	smsendian_handle_tx_message((struct SmsMsgHdr_ST *)&Msg);
	return smsdvb_sendrequest_and_wait(client, &Msg, sizeof(Msg),
					   &client->get_stats_done);

}
Example #3
0
static int smsdvb_send_statistics_request(struct smsdvb_client_t *client)
{
	int rc;
	struct sms_msg_hdr msg;

	/* 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);

	msg.msg_src_id = DVBT_BDA_CONTROL_MSG_ID;
	msg.msg_dst_id = HIF_TASK;
	msg.msg_flags = 0;
	msg.msg_length = sizeof(msg);

	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)
			msg.msg_type = MSG_SMS_GET_STATISTICS_EX_REQ;
		else
			msg.msg_type = MSG_SMS_GET_STATISTICS_REQ;
		break;
	default:
		msg.msg_type = MSG_SMS_GET_STATISTICS_REQ;
	}

	rc = smsdvb_sendrequest_and_wait(client, &msg, sizeof(msg),
					 &client->stats_done);

	return rc;
}
Example #4
0
static int smsdvb_tune_isdbt(struct smsdvb_client_t *client, 
			     struct dvb_frontend_parameters *fep)
{
	struct {
		struct SmsMsgHdr_ST Msg;
		u32 Data[4];
	} Msg;

	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);
	Msg.Data[0] = fep->frequency;
	Msg.Data[1] = BW_ISDBT_1SEG;
	Msg.Data[2] = 12000000;
	Msg.Data[3] = 0;

	sms_debug("freq %d msgType %d Msg.Data[1] %d",
		  fep->frequency, Msg.Msg.msgType, BW_ISDBT_1SEG);

	return smsdvb_sendrequest_and_wait(client, &Msg, sizeof(Msg),
					   &client->tune_done);
}
Example #5
0
static int smsdvb_isdbt_set_frontend(struct dvb_frontend *fe)
{
	struct dtv_frontend_properties *c = &fe->dtv_property_cache;
	struct smsdvb_client_t *client =
		container_of(fe, struct smsdvb_client_t, frontend);
	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;
	int ret;

	struct {
		struct sms_msg_hdr	msg;
		u32		Data[4];
	} msg;

	fe->dtv_property_cache.delivery_system = SYS_ISDBT;

	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);

	if (c->isdbt_sb_segment_idx == -1)
		c->isdbt_sb_segment_idx = 0;

	if (!c->isdbt_layer_enabled)
		c->isdbt_layer_enabled = 7;

	msg.Data[0] = c->frequency;
	msg.Data[1] = BW_ISDBT_1SEG;
	msg.Data[2] = 12000000;
	msg.Data[3] = c->isdbt_sb_segment_idx;

	if (c->isdbt_partial_reception) {
		if ((type == SMS_PELE || type == SMS_RIO) &&
		    c->isdbt_sb_segment_count > 3)
			msg.Data[1] = BW_ISDBT_13SEG;
		else if (c->isdbt_sb_segment_count > 1)
			msg.Data[1] = BW_ISDBT_3SEG;
	} else if (type == SMS_PELE || type == SMS_RIO)
		msg.Data[1] = BW_ISDBT_13SEG;

	c->bandwidth_hz = 6000000;

	pr_debug("freq %d segwidth %d segindex %d\n",
		 c->frequency, c->isdbt_sb_segment_count,
		 c->isdbt_sb_segment_idx);

	/* Disable LNA, if any. An error is returned if no LNA is present */
	ret = sms_board_lna_control(client->coredev, 0);
	if (ret == 0) {
		enum fe_status 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;

		/* previous tune didn't lock - enable LNA and tune again */
		sms_board_lna_control(client->coredev, 1);
	}
	return smsdvb_sendrequest_and_wait(client, &msg, sizeof(msg),
					   &client->tune_done);
}
Example #6
0
static int smsdvb_dvbt_set_frontend(struct dvb_frontend *fe)
{
	struct dtv_frontend_properties *c = &fe->dtv_property_cache;
	struct smsdvb_client_t *client =
		container_of(fe, struct smsdvb_client_t, frontend);

	struct {
		struct sms_msg_hdr	msg;
		u32		Data[3];
	} msg;

	int ret;

	client->fe_status = 0;
	client->event_fe_state = -1;
	client->event_unc_state = -1;
	fe->dtv_property_cache.delivery_system = SYS_DVBT;

	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;

	pr_debug("%s: freq %d band %d\n", __func__, c->frequency,
		 c->bandwidth_hz);

	switch (c->bandwidth_hz / 1000000) {
	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;
	}
	/* Disable LNA, if any. An error is returned if no LNA is present */
	ret = sms_board_lna_control(client->coredev, 0);
	if (ret == 0) {
		enum fe_status 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;

		/* previous tune didn't lock - enable LNA and tune again */
		sms_board_lna_control(client->coredev, 1);
	}

	return smsdvb_sendrequest_and_wait(client, &msg, sizeof(msg),
					   &client->tune_done);
}