Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 75028
b: refs/heads/master
c: 74cda16
h: refs/heads/master
v: v3
  • Loading branch information
Stefano Brivio authored and John W. Linville committed Dec 17, 2007
1 parent 27d8c95 commit 70f1068
Show file tree
Hide file tree
Showing 68 changed files with 390 additions and 482 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: 961994a0c2a24d9622eea7144b30ac773169659f
refs/heads/master: 74cda169fe65ca1dedad6d4a905b13c6ccd87351
45 changes: 41 additions & 4 deletions trunk/Documentation/i2c/summary
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
This is an explanation of what i2c is, and what is supported in this package.

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

Expand Down Expand Up @@ -31,17 +33,52 @@ 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 either depends on one algorithm
driver, or includes its own implementation.
of I2C adapters. Each specific adapter driver depends on one algorithm
driver.

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, and
drivers for your I2C devices (usually one driver for each device).
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.

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)

6 changes: 6 additions & 0 deletions trunk/MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -2489,6 +2489,12 @@ M: mtk.manpages@gmail.com
W: ftp://ftp.kernel.org/pub/linux/docs/manpages
S: Maintained

MARVELL LIBERTAS WIRELESS DRIVER
P: Dan Williams
M: dcbw@redhat.com
L: libertas-dev@lists.infradead.org
S: Maintained

MARVELL MV643XX ETHERNET DRIVER
P: Dale Farnsworth
M: dale@farnsworth.org
Expand Down
19 changes: 6 additions & 13 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, busy_mask;
u64 pstate, ver;
int nack_busy_id, is_jbus, need_more;

if (cpus_empty(mask))
Expand Down Expand Up @@ -508,20 +508,14 @@ 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) {
busy_mask |= (0x1UL << (i * 2));
} else {
if (!is_jbus)
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 @@ -537,16 +531,15 @@ static void cheetah_xcall_deliver(u64 data0, u64 data1, u64 data2, cpumask_t mas

/* Now, poll for completion. */
{
u64 dispatch_stat, nack_mask;
u64 dispatch_stat;
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 & (busy_mask | nack_mask))) {
if (dispatch_stat == 0UL) {
__asm__ __volatile__("wrpr %0, 0x0, %%pstate"
: : "r" (pstate));
if (unlikely(need_more)) {
Expand All @@ -563,12 +556,12 @@ static void cheetah_xcall_deliver(u64 data0, u64 data1, u64 data2, cpumask_t mas
}
if (!--stuck)
break;
} while (dispatch_stat & busy_mask);
} while (dispatch_stat & 0x5555555555555555UL);

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

if (dispatch_stat & busy_mask) {
if ((dispatch_stat & ~(0x5555555555555555UL)) == 0) {
/* 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: 0 additions & 1 deletion trunk/drivers/i2c/busses/i2c-gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ 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: 9 additions & 2 deletions trunk/drivers/media/common/saa7146_video.c
Original file line number Diff line number Diff line change
Expand Up @@ -1205,17 +1205,21 @@ 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)
if (err < 0) {
mutex_unlock(&q->lock);
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 @@ -1436,7 +1440,10 @@ static void video_close(struct saa7146_dev *dev, struct file *file)
err = saa7146_stop_preview(fh);
}

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

/* hmm, why is this function declared void? */
/* return err */
Expand Down
3 changes: 0 additions & 3 deletions trunk/drivers/media/dvb/dvb-usb/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,3 @@ 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: 0 additions & 4 deletions trunk/drivers/media/dvb/dvb-usb/dibusb-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,6 @@ 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 @@ -308,7 +305,6 @@ 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, 0x80); // all SEC off, no 22k tone
tda10086_write_byte(state, 0x36, 0x00); // all SEC off
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, 0x80);
tda10086_write_byte(state, 0x36, 0x00);
break;

case SEC_TONE_ON:
tda10086_write_byte(state, 0x36, 0x81);
tda10086_write_byte(state, 0x36, 0x01);
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, 0x88 | ((cmd->msg_len - 1) << 4));
tda10086_write_byte(state, 0x36, 0x08 | ((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, 0x84);
tda10086_write_byte(state, 0x36, 0x04);
break;

case SEC_MINI_B:
tda10086_write_byte(state, 0x36, 0x86);
tda10086_write_byte(state, 0x36, 0x06);
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 = 45056; /* 45.056 MHz */
u32 adc_clock = 22528; /* 20.480 MHz on the board(!?) */
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 = (bw * (1 << 23) / 7 * 125 + adc_clock / 2) / adc_clock;
*nominal_rate = (64 * bw * (1<<16) / (7 * 8) * 4000 / adc_clock + 2) / 4;

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: 45056 */
int adc_clock; // default: 22528

/* 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 __init bttv_check_chipset(void)
void __devinit bttv_check_chipset(void)
{
int pcipci_fail = 0;
struct pci_dev *dev = NULL;
Expand Down
Loading

0 comments on commit 70f1068

Please sign in to comment.