Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 75037
b: refs/heads/master
c: 8085106
h: refs/heads/master
i:
  75035: ac7547c
v: v3
  • Loading branch information
Jeff Garzik committed Dec 17, 2007
1 parent cb5c249 commit 7b73de1
Show file tree
Hide file tree
Showing 67 changed files with 482 additions and 384 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 53e490936a91940a153e231c3b8288e3ecfcc5aa
refs/heads/master: 8085106a58366fb2c6c14d89e3d4395d2702d4a1
45 changes: 4 additions & 41 deletions trunk/Documentation/i2c/summary
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
This is an explanation of what i2c is, and what is supported in this package.

I2C and SMBus
=============

Expand Down Expand Up @@ -33,52 +31,17 @@ When we talk about I2C, we use the following terms:
Client

An Algorithm driver contains general code that can be used for a whole class
of I2C adapters. Each specific adapter driver depends on one algorithm
driver.
of I2C adapters. Each specific adapter driver either depends on one algorithm
driver, or includes its own implementation.

A Driver driver (yes, this sounds ridiculous, sorry) contains the general
code to access some type of device. Each detected device gets its own
data in the Client structure. Usually, Driver and Client are more closely
integrated than Algorithm and Adapter.

For a given configuration, you will need a driver for your I2C bus (usually
a separate Adapter and Algorithm driver), and drivers for your I2C devices
(usually one driver for each device). There are no I2C device drivers
in this package. See the lm_sensors project http://www.lm-sensors.nu
for device drivers.
For a given configuration, you will need a driver for your I2C bus, and
drivers for your I2C devices (usually one driver for each device).

At this time, Linux only operates I2C (or SMBus) in master mode; you can't
use these APIs to make a Linux system behave as a slave/device, either to
speak a custom protocol or to emulate some other device.


Included Bus Drivers
====================
Note that only stable drivers are patched into the kernel by 'mkpatch'.


Base modules
------------

i2c-core: The basic I2C code, including the /proc/bus/i2c* interface
i2c-dev: The /dev/i2c-* interface
i2c-proc: The /proc/sys/dev/sensors interface for device (client) drivers

Algorithm drivers
-----------------

i2c-algo-bit: A bit-banging algorithm
i2c-algo-pcf: A PCF 8584 style algorithm
i2c-algo-ibm_ocp: An algorithm for the I2C device in IBM 4xx processors (NOT BUILT BY DEFAULT)

Adapter drivers
---------------

i2c-elektor: Elektor ISA card (uses i2c-algo-pcf)
i2c-elv: ELV parallel port adapter (uses i2c-algo-bit)
i2c-pcf-epp: PCF8584 on a EPP parallel port (uses i2c-algo-pcf) (NOT mkpatched)
i2c-philips-par: Philips style parallel port adapter (uses i2c-algo-bit)
i2c-adap-ibm_ocp: IBM 4xx processor I2C device (uses i2c-algo-ibm_ocp) (NOT BUILT BY DEFAULT)
i2c-pport: Primitive parallel port adapter (uses i2c-algo-bit)
i2c-velleman: Velleman K8000 parallel port adapter (uses i2c-algo-bit)

19 changes: 13 additions & 6 deletions trunk/arch/sparc64/kernel/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ static inline void spitfire_xcall_deliver(u64 data0, u64 data1, u64 data2, cpuma
*/
static void cheetah_xcall_deliver(u64 data0, u64 data1, u64 data2, cpumask_t mask)
{
u64 pstate, ver;
u64 pstate, ver, busy_mask;
int nack_busy_id, is_jbus, need_more;

if (cpus_empty(mask))
Expand Down Expand Up @@ -508,14 +508,20 @@ static void cheetah_xcall_deliver(u64 data0, u64 data1, u64 data2, cpumask_t mas
"i" (ASI_INTR_W));

nack_busy_id = 0;
busy_mask = 0;
{
int i;

for_each_cpu_mask(i, mask) {
u64 target = (i << 14) | 0x70;

if (!is_jbus)
if (is_jbus) {
busy_mask |= (0x1UL << (i * 2));
} else {
target |= (nack_busy_id << 24);
busy_mask |= (0x1UL <<
(nack_busy_id * 2));
}
__asm__ __volatile__(
"stxa %%g0, [%0] %1\n\t"
"membar #Sync\n\t"
Expand All @@ -531,15 +537,16 @@ static void cheetah_xcall_deliver(u64 data0, u64 data1, u64 data2, cpumask_t mas

/* Now, poll for completion. */
{
u64 dispatch_stat;
u64 dispatch_stat, nack_mask;
long stuck;

stuck = 100000 * nack_busy_id;
nack_mask = busy_mask << 1;
do {
__asm__ __volatile__("ldxa [%%g0] %1, %0"
: "=r" (dispatch_stat)
: "i" (ASI_INTR_DISPATCH_STAT));
if (dispatch_stat == 0UL) {
if (!(dispatch_stat & (busy_mask | nack_mask))) {
__asm__ __volatile__("wrpr %0, 0x0, %%pstate"
: : "r" (pstate));
if (unlikely(need_more)) {
Expand All @@ -556,12 +563,12 @@ static void cheetah_xcall_deliver(u64 data0, u64 data1, u64 data2, cpumask_t mas
}
if (!--stuck)
break;
} while (dispatch_stat & 0x5555555555555555UL);
} while (dispatch_stat & busy_mask);

__asm__ __volatile__("wrpr %0, 0x0, %%pstate"
: : "r" (pstate));

if ((dispatch_stat & ~(0x5555555555555555UL)) == 0) {
if (dispatch_stat & busy_mask) {
/* Busy bits will not clear, continue instead
* of freezing up on this cpu.
*/
Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/um/drivers/net_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ static int uml_net_rx(struct net_device *dev)
if (pkt_len > 0) {
skb_trim(skb, pkt_len);
skb->protocol = (*lp->protocol)(skb);
netif_rx(skb);

lp->stats.rx_bytes += skb->len;
lp->stats.rx_packets++;
netif_rx(skb);
return pkt_len;
}

Expand Down
4 changes: 2 additions & 2 deletions trunk/arch/xtensa/platform-iss/network.c
Original file line number Diff line number Diff line change
Expand Up @@ -393,11 +393,11 @@ static int iss_net_rx(struct net_device *dev)
if (pkt_len > 0) {
skb_trim(skb, pkt_len);
skb->protocol = lp->tp.protocol(skb);
// netif_rx(skb);
netif_rx_ni(skb);

lp->stats.rx_bytes += skb->len;
lp->stats.rx_packets++;
// netif_rx(skb);
netif_rx_ni(skb);
return pkt_len;
}
kfree_skb(skb);
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/i2c/busses/i2c-davinci.c
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ static irqreturn_t i2c_davinci_isr(int this_irq, void *dev_id)
DAVINCI_I2C_STR_REG,
w);
} else
dev_err(dev->dev, "RDR IRQ while no"
dev_err(dev->dev, "RDR IRQ while no "
"data requested\n");
break;

Expand All @@ -423,7 +423,7 @@ static irqreturn_t i2c_davinci_isr(int this_irq, void *dev_id)
DAVINCI_I2C_IMR_REG,
w);
} else
dev_err(dev->dev, "TDR IRQ while no data to"
dev_err(dev->dev, "TDR IRQ while no data to "
"send\n");
break;

Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/i2c/busses/i2c-gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ static int __init i2c_gpio_probe(struct platform_device *pdev)
adap->owner = THIS_MODULE;
snprintf(adap->name, sizeof(adap->name), "i2c-gpio%d", pdev->id);
adap->algo_data = bit_data;
adap->class = I2C_CLASS_HWMON;
adap->dev.parent = &pdev->dev;

/*
Expand Down
6 changes: 3 additions & 3 deletions trunk/drivers/i2c/busses/i2c-omap.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
while (!(omap_i2c_read_reg(dev, OMAP_I2C_SYSS_REG) &
OMAP_I2C_SYSS_RDONE)) {
if (time_after(jiffies, timeout)) {
dev_warn(dev->dev, "timeout waiting"
dev_warn(dev->dev, "timeout waiting "
"for controller reset\n");
return -ETIMEDOUT;
}
Expand Down Expand Up @@ -483,7 +483,7 @@ omap_i2c_isr(int this_irq, void *dev_id)
dev->buf_len--;
}
} else
dev_err(dev->dev, "RRDY IRQ while no data"
dev_err(dev->dev, "RRDY IRQ while no data "
"requested\n");
omap_i2c_ack_stat(dev, OMAP_I2C_STAT_RRDY);
continue;
Expand All @@ -498,7 +498,7 @@ omap_i2c_isr(int this_irq, void *dev_id)
dev->buf_len--;
}
} else
dev_err(dev->dev, "XRDY IRQ while no"
dev_err(dev->dev, "XRDY IRQ while no "
"data to send\n");
omap_i2c_write_reg(dev, OMAP_I2C_DATA_REG, w);
omap_i2c_ack_stat(dev, OMAP_I2C_STAT_XRDY);
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/i2c/chips/isp1301_omap.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <linux/interrupt.h>
#include <linux/platform_device.h>
#include <linux/usb/ch9.h>
#include <linux/usb_gadget.h>
#include <linux/usb/gadget.h>
#include <linux/usb.h>
#include <linux/usb/otg.h>
#include <linux/i2c.h>
Expand Down
11 changes: 2 additions & 9 deletions trunk/drivers/media/common/saa7146_video.c
Original file line number Diff line number Diff line change
Expand Up @@ -1205,21 +1205,17 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
DEB_D(("VIDIOCGMBUF \n"));

q = &fh->video_q;
mutex_lock(&q->lock);
err = videobuf_mmap_setup(q,gbuffers,gbufsize,
V4L2_MEMORY_MMAP);
if (err < 0) {
mutex_unlock(&q->lock);
if (err < 0)
return err;
}

gbuffers = err;
memset(mbuf,0,sizeof(*mbuf));
mbuf->frames = gbuffers;
mbuf->size = gbuffers * gbufsize;
for (i = 0; i < gbuffers; i++)
mbuf->offsets[i] = i * gbufsize;
mutex_unlock(&q->lock);
return 0;
}
#endif
Expand Down Expand Up @@ -1440,10 +1436,7 @@ static void video_close(struct saa7146_dev *dev, struct file *file)
err = saa7146_stop_preview(fh);
}

// release all capture buffers
mutex_lock(&q->lock);
videobuf_read_stop(q);
mutex_unlock(&q->lock);
videobuf_stop(q);

/* hmm, why is this function declared void? */
/* return err */
Expand Down
3 changes: 3 additions & 0 deletions trunk/drivers/media/dvb/dvb-usb/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,6 @@ dvb-usb-af9005-remote-objs = af9005-remote.o
obj-$(CONFIG_DVB_USB_AF9005_REMOTE) += dvb-usb-af9005-remote.o

EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core/ -Idrivers/media/dvb/frontends/
# due to tuner-xc3028
EXTRA_CFLAGS += -Idrivers/media/video

4 changes: 4 additions & 0 deletions trunk/drivers/media/dvb/dvb-usb/dibusb-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,9 @@ static struct dibx000_agc_config dib3000p_panasonic_agc_config = {
.agc2_slope2 = 0x1e,
};

#if defined(CONFIG_DVB_DIB3000MC) || \
(defined(CONFIG_DVB_DIB3000MC_MODULE) && defined(MODULE))

static struct dib3000mc_config mod3000p_dib3000p_config = {
&dib3000p_panasonic_agc_config,

Expand Down Expand Up @@ -305,6 +308,7 @@ int dibusb_dib3000mc_tuner_attach(struct dvb_usb_adapter *adap)
return 0;
}
EXPORT_SYMBOL(dibusb_dib3000mc_tuner_attach);
#endif

/*
* common remote control stuff
Expand Down
14 changes: 7 additions & 7 deletions trunk/drivers/media/dvb/frontends/tda10086.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ static int tda10086_init(struct dvb_frontend* fe)
tda10086_write_byte(state, 0x3d, 0x80);

// setup SEC
tda10086_write_byte(state, 0x36, 0x00); // all SEC off
tda10086_write_byte(state, 0x36, 0x80); // all SEC off, no 22k tone
tda10086_write_byte(state, 0x34, (((1<<19) * (22000/1000)) / (SACLK/1000))); // } tone frequency
tda10086_write_byte(state, 0x35, (((1<<19) * (22000/1000)) / (SACLK/1000)) >> 8); // }

Expand All @@ -183,13 +183,13 @@ static int tda10086_set_tone (struct dvb_frontend* fe, fe_sec_tone_mode_t tone)

dprintk ("%s\n", __FUNCTION__);

switch(tone) {
switch (tone) {
case SEC_TONE_OFF:
tda10086_write_byte(state, 0x36, 0x00);
tda10086_write_byte(state, 0x36, 0x80);
break;

case SEC_TONE_ON:
tda10086_write_byte(state, 0x36, 0x01);
tda10086_write_byte(state, 0x36, 0x81);
break;
}

Expand All @@ -212,7 +212,7 @@ static int tda10086_send_master_cmd (struct dvb_frontend* fe,
for(i=0; i< cmd->msg_len; i++) {
tda10086_write_byte(state, 0x48+i, cmd->msg[i]);
}
tda10086_write_byte(state, 0x36, 0x08 | ((cmd->msg_len - 1) << 4));
tda10086_write_byte(state, 0x36, 0x88 | ((cmd->msg_len - 1) << 4));

tda10086_diseqc_wait(state);

Expand All @@ -230,11 +230,11 @@ static int tda10086_send_burst (struct dvb_frontend* fe, fe_sec_mini_cmd_t minic

switch(minicmd) {
case SEC_MINI_A:
tda10086_write_byte(state, 0x36, 0x04);
tda10086_write_byte(state, 0x36, 0x84);
break;

case SEC_MINI_B:
tda10086_write_byte(state, 0x36, 0x06);
tda10086_write_byte(state, 0x36, 0x86);
break;
}

Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/media/dvb/frontends/zl10353.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ static void zl10353_calc_nominal_rate(struct dvb_frontend *fe,
enum fe_bandwidth bandwidth,
u16 *nominal_rate)
{
u32 adc_clock = 22528; /* 20.480 MHz on the board(!?) */
u32 adc_clock = 45056; /* 45.056 MHz */
u8 bw;
struct zl10353_state *state = fe->demodulator_priv;

Expand All @@ -142,7 +142,7 @@ static void zl10353_calc_nominal_rate(struct dvb_frontend *fe,
break;
}

*nominal_rate = (64 * bw * (1<<16) / (7 * 8) * 4000 / adc_clock + 2) / 4;
*nominal_rate = (bw * (1 << 23) / 7 * 125 + adc_clock / 2) / adc_clock;

dprintk("%s: bw %d, adc_clock %d => 0x%x\n",
__FUNCTION__, bw, adc_clock, *nominal_rate);
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/media/dvb/frontends/zl10353.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ struct zl10353_config
u8 demod_address;

/* frequencies in kHz */
int adc_clock; // default: 22528
int adc_clock; /* default: 45056 */

/* set if no pll is connected to the secondary i2c bus */
int no_tuner;
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/media/video/bt8xx/bttv-cards.c
Original file line number Diff line number Diff line change
Expand Up @@ -5080,7 +5080,7 @@ static void PXC200_muxsel(struct bttv *btv, unsigned int input)
/* ----------------------------------------------------------------------- */
/* motherboard chipset specific stuff */

void __devinit bttv_check_chipset(void)
void __init bttv_check_chipset(void)
{
int pcipci_fail = 0;
struct pci_dev *dev = NULL;
Expand Down
9 changes: 3 additions & 6 deletions trunk/drivers/media/video/bt8xx/bttv-driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -3827,10 +3827,7 @@ static int bttv_release(struct inode *inode, struct file *file)

/* stop vbi capture */
if (check_btres(fh, RESOURCE_VBI)) {
if (fh->vbi.streaming)
videobuf_streamoff(&fh->vbi);
if (fh->vbi.reading)
videobuf_read_stop(&fh->vbi);
videobuf_stop(&fh->vbi);
free_btres(btv,fh,RESOURCE_VBI);
}

Expand Down Expand Up @@ -4988,7 +4985,7 @@ static struct pci_driver bttv_pci_driver = {
#endif
};

static int bttv_init_module(void)
static int __init bttv_init_module(void)
{
int ret;

Expand Down Expand Up @@ -5021,7 +5018,7 @@ static int bttv_init_module(void)
return pci_register_driver(&bttv_pci_driver);
}

static void bttv_cleanup_module(void)
static void __exit bttv_cleanup_module(void)
{
pci_unregister_driver(&bttv_pci_driver);
bus_unregister(&bttv_sub_bus_type);
Expand Down
Loading

0 comments on commit 7b73de1

Please sign in to comment.