/*
STB0899 Multistandard Frontend driver
Copyright (C) Manu Abraham (abraham.manu@gmail.com)
Copyright (C) ST Microelectronics
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, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "stb0899_drv.h"
#include "stb0899_priv.h"
#include "stb0899_reg.h"
inline u32 stb0899_do_div(u64 n, u32 d)
{
/* wrap do_div() for ease of use */
do_div(n, d);
return n;
}
#if 0
/* These functions are currently unused */
/*
* stb0899_calc_srate
* Compute symbol rate
*/
static u32 stb0899_calc_srate(u32 master_clk, u8 *sfr)
{
u64 tmp;
/* srate = (SFR * master_clk) >> 20 */
/* sfr is of size 20 bit, stored with an offset of 4 bit */
tmp = (((u32)sfr[0]) << 16) | (((u32)sfr[1]) << 8) | sfr[2];
tmp &= ~0xf;
tmp *= master_clk;
tmp >>= 24;
return tmp;
}
/*
* stb0899_get_srate
* Get the current symbol rate
*/
static u32 stb0899_get_srate(struct stb0899_state *state)
{
struct stb0899_internal *