aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/common/saa7146_core.c4
-rw-r--r--drivers/media/common/saa7146_hlp.c2
-rw-r--r--drivers/media/common/saa7146_i2c.c34
-rw-r--r--drivers/media/common/saa7146_video.c4
-rw-r--r--include/media/saa7146.h4
5 files changed, 24 insertions, 24 deletions
diff --git a/drivers/media/common/saa7146_core.c b/drivers/media/common/saa7146_core.c
index 89c7660b85d6..d01965e96927 100644
--- a/drivers/media/common/saa7146_core.c
+++ b/drivers/media/common/saa7146_core.c
@@ -233,7 +233,7 @@ void saa7146_pgtable_free(struct pci_dev *pci, struct saa7146_pgtable *pt)
233 233
234int saa7146_pgtable_alloc(struct pci_dev *pci, struct saa7146_pgtable *pt) 234int saa7146_pgtable_alloc(struct pci_dev *pci, struct saa7146_pgtable *pt)
235{ 235{
236 u32 *cpu; 236 __le32 *cpu;
237 dma_addr_t dma_addr; 237 dma_addr_t dma_addr;
238 238
239 cpu = pci_alloc_consistent(pci, PAGE_SIZE, &dma_addr); 239 cpu = pci_alloc_consistent(pci, PAGE_SIZE, &dma_addr);
@@ -250,7 +250,7 @@ int saa7146_pgtable_alloc(struct pci_dev *pci, struct saa7146_pgtable *pt)
250int saa7146_pgtable_build_single(struct pci_dev *pci, struct saa7146_pgtable *pt, 250int saa7146_pgtable_build_single(struct pci_dev *pci, struct saa7146_pgtable *pt,
251 struct scatterlist *list, int sglen ) 251 struct scatterlist *list, int sglen )
252{ 252{
253 u32 *ptr, fill; 253 __le32 *ptr, fill;
254 int nr_pages = 0; 254 int nr_pages = 0;
255 int i,p; 255 int i,p;
256 256
diff --git a/drivers/media/common/saa7146_hlp.c b/drivers/media/common/saa7146_hlp.c
index 9c905399a233..05bde9ccb770 100644
--- a/drivers/media/common/saa7146_hlp.c
+++ b/drivers/media/common/saa7146_hlp.c
@@ -338,7 +338,7 @@ static void calculate_clipping_registers_rect(struct saa7146_dev *dev, struct sa
338 struct saa7146_video_dma *vdma2, u32* clip_format, u32* arbtr_ctrl, enum v4l2_field field) 338 struct saa7146_video_dma *vdma2, u32* clip_format, u32* arbtr_ctrl, enum v4l2_field field)
339{ 339{
340 struct saa7146_vv *vv = dev->vv_data; 340 struct saa7146_vv *vv = dev->vv_data;
341 u32 *clipping = vv->d_clipping.cpu_addr; 341 __le32 *clipping = vv->d_clipping.cpu_addr;
342 342
343 int width = fh->ov.win.w.width; 343 int width = fh->ov.win.w.width;
344 int height = fh->ov.win.w.height; 344 int height = fh->ov.win.w.height;
diff --git a/drivers/media/common/saa7146_i2c.c b/drivers/media/common/saa7146_i2c.c
index 35b01ec40a51..c11da4d09cd0 100644
--- a/drivers/media/common/saa7146_i2c.c
+++ b/drivers/media/common/saa7146_i2c.c
@@ -24,7 +24,7 @@ static inline u32 saa7146_i2c_status(struct saa7146_dev *dev)
24 sent through the saa7146. have a look at the specifications p. 122 ff 24 sent through the saa7146. have a look at the specifications p. 122 ff
25 to understand this. it returns the number of u32s to send, or -1 25 to understand this. it returns the number of u32s to send, or -1
26 in case of an error. */ 26 in case of an error. */
27static int saa7146_i2c_msg_prepare(const struct i2c_msg *m, int num, u32 *op) 27static int saa7146_i2c_msg_prepare(const struct i2c_msg *m, int num, __le32 *op)
28{ 28{
29 int h1, h2; 29 int h1, h2;
30 int i, j, addr; 30 int i, j, addr;
@@ -47,7 +47,7 @@ static int saa7146_i2c_msg_prepare(const struct i2c_msg *m, int num, u32 *op)
47 } 47 }
48 48
49 /* be careful: clear out the i2c-mem first */ 49 /* be careful: clear out the i2c-mem first */
50 memset(op,0,sizeof(u32)*mem); 50 memset(op,0,sizeof(__le32)*mem);
51 51
52 /* loop through all messages */ 52 /* loop through all messages */
53 for(i = 0; i < num; i++) { 53 for(i = 0; i < num; i++) {
@@ -57,16 +57,16 @@ static int saa7146_i2c_msg_prepare(const struct i2c_msg *m, int num, u32 *op)
57 so we have to perform a translation */ 57 so we have to perform a translation */
58 addr = (m[i].addr*2) + ( (0 != (m[i].flags & I2C_M_RD)) ? 1 : 0); 58 addr = (m[i].addr*2) + ( (0 != (m[i].flags & I2C_M_RD)) ? 1 : 0);
59 h1 = op_count/3; h2 = op_count%3; 59 h1 = op_count/3; h2 = op_count%3;
60 op[h1] |= ( (u8)addr << ((3-h2)*8)); 60 op[h1] |= cpu_to_le32( (u8)addr << ((3-h2)*8));
61 op[h1] |= (SAA7146_I2C_START << ((3-h2)*2)); 61 op[h1] |= cpu_to_le32(SAA7146_I2C_START << ((3-h2)*2));
62 op_count++; 62 op_count++;
63 63
64 /* loop through all bytes of message i */ 64 /* loop through all bytes of message i */
65 for(j = 0; j < m[i].len; j++) { 65 for(j = 0; j < m[i].len; j++) {
66 /* insert the data bytes */ 66 /* insert the data bytes */
67 h1 = op_count/3; h2 = op_count%3; 67 h1 = op_count/3; h2 = op_count%3;
68 op[h1] |= ( (u32)((u8)m[i].buf[j]) << ((3-h2)*8)); 68 op[h1] |= cpu_to_le32( (u32)((u8)m[i].buf[j]) << ((3-h2)*8));
69 op[h1] |= ( SAA7146_I2C_CONT << ((3-h2)*2)); 69 op[h1] |= cpu_to_le32( SAA7146_I2C_CONT << ((3-h2)*2));
70 op_count++; 70 op_count++;
71 } 71 }
72 72
@@ -75,9 +75,9 @@ static int saa7146_i2c_msg_prepare(const struct i2c_msg *m, int num, u32 *op)
75 /* have a look at the last byte inserted: 75 /* have a look at the last byte inserted:
76 if it was: ...CONT change it to ...STOP */ 76 if it was: ...CONT change it to ...STOP */
77 h1 = (op_count-1)/3; h2 = (op_count-1)%3; 77 h1 = (op_count-1)/3; h2 = (op_count-1)%3;
78 if ( SAA7146_I2C_CONT == (0x3 & (op[h1] >> ((3-h2)*2))) ) { 78 if ( SAA7146_I2C_CONT == (0x3 & (le32_to_cpu(op[h1]) >> ((3-h2)*2))) ) {
79 op[h1] &= ~(0x2 << ((3-h2)*2)); 79 op[h1] &= ~cpu_to_le32(0x2 << ((3-h2)*2));
80 op[h1] |= (SAA7146_I2C_STOP << ((3-h2)*2)); 80 op[h1] |= cpu_to_le32(SAA7146_I2C_STOP << ((3-h2)*2));
81 } 81 }
82 82
83 /* return the number of u32s to send */ 83 /* return the number of u32s to send */
@@ -88,7 +88,7 @@ static int saa7146_i2c_msg_prepare(const struct i2c_msg *m, int num, u32 *op)
88 which bytes were read through the adapter and write them back to the corresponding 88 which bytes were read through the adapter and write them back to the corresponding
89 i2c-message. but instead, we simply write back all bytes. 89 i2c-message. but instead, we simply write back all bytes.
90 fixme: this could be improved. */ 90 fixme: this could be improved. */
91static int saa7146_i2c_msg_cleanup(const struct i2c_msg *m, int num, u32 *op) 91static int saa7146_i2c_msg_cleanup(const struct i2c_msg *m, int num, __le32 *op)
92{ 92{
93 int i, j; 93 int i, j;
94 int op_count = 0; 94 int op_count = 0;
@@ -101,7 +101,7 @@ static int saa7146_i2c_msg_cleanup(const struct i2c_msg *m, int num, u32 *op)
101 /* loop throgh all bytes of message i */ 101 /* loop throgh all bytes of message i */
102 for(j = 0; j < m[i].len; j++) { 102 for(j = 0; j < m[i].len; j++) {
103 /* write back all bytes that could have been read */ 103 /* write back all bytes that could have been read */
104 m[i].buf[j] = (op[op_count/3] >> ((3-(op_count%3))*8)); 104 m[i].buf[j] = (le32_to_cpu(op[op_count/3]) >> ((3-(op_count%3))*8));
105 op_count++; 105 op_count++;
106 } 106 }
107 } 107 }
@@ -174,7 +174,7 @@ static int saa7146_i2c_reset(struct saa7146_dev *dev)
174/* this functions writes out the data-byte 'dword' to the i2c-device. 174/* this functions writes out the data-byte 'dword' to the i2c-device.
175 it returns 0 if ok, -1 if the transfer failed, -2 if the transfer 175 it returns 0 if ok, -1 if the transfer failed, -2 if the transfer
176 failed badly (e.g. address error) */ 176 failed badly (e.g. address error) */
177static int saa7146_i2c_writeout(struct saa7146_dev *dev, u32* dword, int short_delay) 177static int saa7146_i2c_writeout(struct saa7146_dev *dev, __le32 *dword, int short_delay)
178{ 178{
179 u32 status = 0, mc2 = 0; 179 u32 status = 0, mc2 = 0;
180 int trial = 0; 180 int trial = 0;
@@ -186,7 +186,7 @@ static int saa7146_i2c_writeout(struct saa7146_dev *dev, u32* dword, int short_d
186 if( 0 != (SAA7146_USE_I2C_IRQ & dev->ext->flags)) { 186 if( 0 != (SAA7146_USE_I2C_IRQ & dev->ext->flags)) {
187 187
188 saa7146_write(dev, I2C_STATUS, dev->i2c_bitrate); 188 saa7146_write(dev, I2C_STATUS, dev->i2c_bitrate);
189 saa7146_write(dev, I2C_TRANSFER, *dword); 189 saa7146_write(dev, I2C_TRANSFER, le32_to_cpu(*dword));
190 190
191 dev->i2c_op = 1; 191 dev->i2c_op = 1;
192 SAA7146_ISR_CLEAR(dev, MASK_16|MASK_17); 192 SAA7146_ISR_CLEAR(dev, MASK_16|MASK_17);
@@ -209,7 +209,7 @@ static int saa7146_i2c_writeout(struct saa7146_dev *dev, u32* dword, int short_d
209 status = saa7146_read(dev, I2C_STATUS); 209 status = saa7146_read(dev, I2C_STATUS);
210 } else { 210 } else {
211 saa7146_write(dev, I2C_STATUS, dev->i2c_bitrate); 211 saa7146_write(dev, I2C_STATUS, dev->i2c_bitrate);
212 saa7146_write(dev, I2C_TRANSFER, *dword); 212 saa7146_write(dev, I2C_TRANSFER, le32_to_cpu(*dword));
213 saa7146_write(dev, MC2, (MASK_00 | MASK_16)); 213 saa7146_write(dev, MC2, (MASK_00 | MASK_16));
214 214
215 /* do not poll for i2c-status before upload is complete */ 215 /* do not poll for i2c-status before upload is complete */
@@ -282,7 +282,7 @@ static int saa7146_i2c_writeout(struct saa7146_dev *dev, u32* dword, int short_d
282 } 282 }
283 283
284 /* read back data, just in case we were reading ... */ 284 /* read back data, just in case we were reading ... */
285 *dword = saa7146_read(dev, I2C_TRANSFER); 285 *dword = cpu_to_le32(saa7146_read(dev, I2C_TRANSFER));
286 286
287 DEB_I2C(("after: 0x%08x\n",*dword)); 287 DEB_I2C(("after: 0x%08x\n",*dword));
288 return 0; 288 return 0;
@@ -291,7 +291,7 @@ static int saa7146_i2c_writeout(struct saa7146_dev *dev, u32* dword, int short_d
291static int saa7146_i2c_transfer(struct saa7146_dev *dev, const struct i2c_msg *msgs, int num, int retries) 291static int saa7146_i2c_transfer(struct saa7146_dev *dev, const struct i2c_msg *msgs, int num, int retries)
292{ 292{
293 int i = 0, count = 0; 293 int i = 0, count = 0;
294 u32* buffer = dev->d_i2c.cpu_addr; 294 __le32 *buffer = dev->d_i2c.cpu_addr;
295 int err = 0; 295 int err = 0;
296 int address_err = 0; 296 int address_err = 0;
297 int short_delay = 0; 297 int short_delay = 0;
@@ -376,7 +376,7 @@ out:
376 /* another bug in revision 0: the i2c-registers get uploaded randomly by other 376 /* another bug in revision 0: the i2c-registers get uploaded randomly by other
377 uploads, so we better clear them out before continueing */ 377 uploads, so we better clear them out before continueing */
378 if( 0 == dev->revision ) { 378 if( 0 == dev->revision ) {
379 u32 zero = 0; 379 __le32 zero = 0;
380 saa7146_i2c_reset(dev); 380 saa7146_i2c_reset(dev);
381 if( 0 != saa7146_i2c_writeout(dev, &zero, short_delay)) { 381 if( 0 != saa7146_i2c_writeout(dev, &zero, short_delay)) {
382 INFO(("revision 0 error. this should never happen.\n")); 382 INFO(("revision 0 error. this should never happen.\n"));
diff --git a/drivers/media/common/saa7146_video.c b/drivers/media/common/saa7146_video.c
index 3cbc6ebbe649..a5e62750eea3 100644
--- a/drivers/media/common/saa7146_video.c
+++ b/drivers/media/common/saa7146_video.c
@@ -605,8 +605,8 @@ static int saa7146_pgtable_build(struct saa7146_dev *dev, struct saa7146_buf *bu
605 struct saa7146_pgtable *pt1 = &buf->pt[0]; 605 struct saa7146_pgtable *pt1 = &buf->pt[0];
606 struct saa7146_pgtable *pt2 = &buf->pt[1]; 606 struct saa7146_pgtable *pt2 = &buf->pt[1];
607 struct saa7146_pgtable *pt3 = &buf->pt[2]; 607 struct saa7146_pgtable *pt3 = &buf->pt[2];
608 u32 *ptr1, *ptr2, *ptr3; 608 __le32 *ptr1, *ptr2, *ptr3;
609 u32 fill; 609 __le32 fill;
610 610
611 int size = buf->fmt->width*buf->fmt->height; 611 int size = buf->fmt->width*buf->fmt->height;
612 int i,p,m1,m2,m3,o1,o2; 612 int i,p,m1,m2,m3,o1,o2;
diff --git a/include/media/saa7146.h b/include/media/saa7146.h
index 88b2b5a619aa..2f68f4cd0037 100644
--- a/include/media/saa7146.h
+++ b/include/media/saa7146.h
@@ -53,7 +53,7 @@ struct saa7146_vv;
53/* saa7146 page table */ 53/* saa7146 page table */
54struct saa7146_pgtable { 54struct saa7146_pgtable {
55 unsigned int size; 55 unsigned int size;
56 u32 *cpu; 56 __le32 *cpu;
57 dma_addr_t dma; 57 dma_addr_t dma;
58 /* used for offsets for u,v planes for planar capture modes */ 58 /* used for offsets for u,v planes for planar capture modes */
59 unsigned long offset; 59 unsigned long offset;
@@ -101,7 +101,7 @@ struct saa7146_extension
101struct saa7146_dma 101struct saa7146_dma
102{ 102{
103 dma_addr_t dma_handle; 103 dma_addr_t dma_handle;
104 u32 *cpu_addr; 104 __le32 *cpu_addr;
105}; 105};
106 106
107struct saa7146_dev 107struct saa7146_dev