-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
yaml --- r: 138030 b: refs/heads/master c: c253a17 h: refs/heads/master v: v3
- Loading branch information
Abylay Ospan
authored and
Mauro Carvalho Chehab
committed
Mar 30, 2009
1 parent
52cccac
commit c23819a
Showing
3 changed files
with
151 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
--- | ||
refs/heads/master: 9cfb6a3f1b16e82fab97831265858aa2d1983883 | ||
refs/heads/master: c253a17126d6e841720d5926c6d426745693676b |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
/* | ||
* netup-init.c | ||
* | ||
* NetUP Dual DVB-S2 CI driver | ||
* | ||
* Copyright (C) 2009 NetUP Inc. | ||
* Copyright (C) 2009 Igor M. Liplianin <liplianin@netup.ru> | ||
* Copyright (C) 2009 Abylay Ospan <aospan@netup.ru> | ||
* | ||
* 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 "cx23885.h" | ||
|
||
static void i2c_av_write(struct i2c_adapter *i2c, u16 reg, u8 val) | ||
{ | ||
int ret; | ||
u8 buf[3]; | ||
struct i2c_msg msg = { | ||
.addr = 0x88 >> 1, | ||
.flags = 0, | ||
.buf = buf, | ||
.len = 3 | ||
}; | ||
|
||
buf[0] = reg >> 8; | ||
buf[1] = reg & 0xff; | ||
buf[2] = val; | ||
|
||
ret = i2c_transfer(i2c, &msg, 1); | ||
|
||
if (ret != 1) | ||
printk(KERN_ERR "%s: i2c write error!\n", __func__); | ||
} | ||
|
||
static void i2c_av_write4(struct i2c_adapter *i2c, u16 reg, u32 val) | ||
{ | ||
int ret; | ||
u8 buf[6]; | ||
struct i2c_msg msg = { | ||
.addr = 0x88 >> 1, | ||
.flags = 0, | ||
.buf = buf, | ||
.len = 6 | ||
}; | ||
|
||
buf[0] = reg >> 8; | ||
buf[1] = reg & 0xff; | ||
buf[2] = val & 0xff; | ||
buf[3] = (val >> 8) & 0xff; | ||
buf[4] = (val >> 16) & 0xff; | ||
buf[5] = val >> 24; | ||
|
||
ret = i2c_transfer(i2c, &msg, 1); | ||
|
||
if (ret != 1) | ||
printk(KERN_ERR "%s: i2c write error!\n", __func__); | ||
} | ||
|
||
static u8 i2c_av_read(struct i2c_adapter *i2c, u16 reg) | ||
{ | ||
int ret; | ||
u8 buf[2]; | ||
struct i2c_msg msg = { | ||
.addr = 0x88 >> 1, | ||
.flags = 0, | ||
.buf = buf, | ||
.len = 2 | ||
}; | ||
|
||
buf[0] = reg >> 8; | ||
buf[1] = reg & 0xff; | ||
|
||
ret = i2c_transfer(i2c, &msg, 1); | ||
|
||
if (ret != 1) | ||
printk(KERN_ERR "%s: i2c write error!\n", __func__); | ||
|
||
msg.flags = I2C_M_RD; | ||
msg.len = 1; | ||
|
||
ret = i2c_transfer(i2c, &msg, 1); | ||
|
||
if (ret != 1) | ||
printk(KERN_ERR "%s: i2c read error!\n", __func__); | ||
|
||
return buf[0]; | ||
} | ||
|
||
static void i2c_av_and_or(struct i2c_adapter *i2c, u16 reg, unsigned and_mask, | ||
u8 or_value) | ||
{ | ||
i2c_av_write(i2c, reg, (i2c_av_read(i2c, reg) & and_mask) | or_value); | ||
} | ||
/* set 27MHz on AUX_CLK */ | ||
void netup_initialize(struct cx23885_dev *dev) | ||
{ | ||
struct cx23885_i2c *i2c_bus = &dev->i2c_bus[2]; | ||
struct i2c_adapter *i2c = &i2c_bus->i2c_adap; | ||
|
||
/* Stop microcontroller */ | ||
i2c_av_and_or(i2c, 0x803, ~0x10, 0x00); | ||
|
||
/* Aux PLL frac for 27 MHz */ | ||
i2c_av_write4(i2c, 0x114, 0xea0eb3); | ||
|
||
/* Aux PLL int for 27 MHz */ | ||
i2c_av_write4(i2c, 0x110, 0x090319); | ||
|
||
/* start microcontroller */ | ||
i2c_av_and_or(i2c, 0x803, ~0x10, 0x10); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* netup-init.h | ||
* | ||
* NetUP Dual DVB-S2 CI driver | ||
* | ||
* Copyright (C) 2009 NetUP Inc. | ||
* Copyright (C) 2009 Igor M. Liplianin <liplianin@netup.ru> | ||
* Copyright (C) 2009 Abylay Ospan <aospan@netup.ru> | ||
* | ||
* 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. | ||
*/ | ||
extern void netup_initialize(struct cx23885_dev *dev); |