Skip to content

Commit 69a03e3

Browse files
committed
media: atomisp: get rid of an iomem abstraction layer
The hive_isp_css_custom_host_hrt.h code, together with atomisp_helper.h, provides an abstraction layer for some functions inside atomisp_compat_css20.c and atomisp_cmd.c. There's no good reason for that. In a matter of fact, after removing the abstraction, the code looked a lot cleaner and easier to understand. So, get rid of them. While here, get rid also of the udelay(1) abstraction code. Signed-off-by: Mauro Carvalho Chehab <[email protected]>
1 parent 662fb4f commit 69a03e3

File tree

18 files changed

+44
-192
lines changed

18 files changed

+44
-192
lines changed

drivers/staging/media/atomisp/pci/atomisp_cmd.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -665,6 +665,7 @@ bool atomisp_buffers_queued_pipe(struct atomisp_video_pipe *pipe)
665665
void dump_sp_dmem(struct atomisp_device *isp, unsigned int addr,
666666
unsigned int size)
667667
{
668+
u32 __iomem *io_virt_addr;
668669
unsigned int data = 0;
669670
unsigned int size32 = DIV_ROUND_UP(size, sizeof(u32));
670671

@@ -677,11 +678,11 @@ void dump_sp_dmem(struct atomisp_device *isp, unsigned int addr,
677678
return;
678679
}
679680
addr += SP_DMEM_BASE;
681+
io_virt_addr = atomisp_io_base + (addr & 0x003FFFFF);
680682
do {
681-
data = _hrt_master_port_uload_32(addr);
682-
683+
data = *io_virt_addr;
683684
dev_dbg(isp->dev, "%s, \t [0x%x]:0x%x\n", __func__, addr, data);
684-
addr += sizeof(unsigned int);
685+
io_virt_addr += sizeof(u32);
685686
size32 -= 1;
686687
} while (size32 > 0);
687688
}

drivers/staging/media/atomisp/pci/atomisp_cmd.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,6 @@ bool atomisp_buffers_queued(struct atomisp_sub_device *asd);
6565
/* ISP2401 */
6666
bool atomisp_buffers_queued_pipe(struct atomisp_video_pipe *pipe);
6767

68-
/* TODO:should be here instead of atomisp_helper.h
69-
extern void __iomem *atomisp_io_base;
70-
71-
static inline void __iomem *atomisp_get_io_virt_addr(unsigned int address)
72-
{
73-
void __iomem *ret = atomisp_io_base + (address & 0x003FFFFF);
74-
return ret;
75-
}
76-
*/
77-
7868
/*
7969
* Interrupt functions
8070
*/

drivers/staging/media/atomisp/pci/atomisp_compat.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ struct atomisp_sub_device;
2929
struct video_device;
3030
enum atomisp_input_stream_id;
3131

32+
extern void __iomem *atomisp_io_base;
33+
3234
struct atomisp_metadata_buf {
3335
struct ia_css_metadata *metadata;
3436
void *md_vptr;

drivers/staging/media/atomisp/pci/atomisp_compat_css20.c

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -69,88 +69,92 @@ struct bayer_ds_factor {
6969

7070
static void atomisp_css2_hw_store_8(hrt_address addr, uint8_t data)
7171
{
72+
s8 __iomem *io_virt_addr = atomisp_io_base + (addr & 0x003FFFFF);
7273
unsigned long flags;
7374

7475
spin_lock_irqsave(&mmio_lock, flags);
75-
_hrt_master_port_store_8(addr, data);
76+
*io_virt_addr = data;
7677
spin_unlock_irqrestore(&mmio_lock, flags);
7778
}
7879

7980
static void atomisp_css2_hw_store_16(hrt_address addr, uint16_t data)
8081
{
82+
s16 __iomem *io_virt_addr = atomisp_io_base + (addr & 0x003FFFFF);
8183
unsigned long flags;
8284

8385
spin_lock_irqsave(&mmio_lock, flags);
84-
_hrt_master_port_store_16(addr, data);
86+
*io_virt_addr = data;
8587
spin_unlock_irqrestore(&mmio_lock, flags);
8688
}
8789

8890
void atomisp_css2_hw_store_32(hrt_address addr, uint32_t data)
8991
{
92+
s32 __iomem *io_virt_addr = atomisp_io_base + (addr & 0x003FFFFF);
9093
unsigned long flags;
9194

9295
spin_lock_irqsave(&mmio_lock, flags);
93-
_hrt_master_port_store_32(addr, data);
96+
*io_virt_addr = data;
9497
spin_unlock_irqrestore(&mmio_lock, flags);
9598
}
9699

97100
static uint8_t atomisp_css2_hw_load_8(hrt_address addr)
98101
{
102+
s8 __iomem *io_virt_addr = atomisp_io_base + (addr & 0x003FFFFF);
99103
unsigned long flags;
100104
u8 ret;
101105

102106
spin_lock_irqsave(&mmio_lock, flags);
103-
ret = _hrt_master_port_load_8(addr);
107+
ret = *io_virt_addr;
104108
spin_unlock_irqrestore(&mmio_lock, flags);
105109
return ret;
106110
}
107111

108112
static uint16_t atomisp_css2_hw_load_16(hrt_address addr)
109113
{
114+
s16 __iomem *io_virt_addr = atomisp_io_base + (addr & 0x003FFFFF);
110115
unsigned long flags;
111116
u16 ret;
112117

113118
spin_lock_irqsave(&mmio_lock, flags);
114-
ret = _hrt_master_port_load_16(addr);
119+
ret = *io_virt_addr;
115120
spin_unlock_irqrestore(&mmio_lock, flags);
116121
return ret;
117122
}
118123

119124
static uint32_t atomisp_css2_hw_load_32(hrt_address addr)
120125
{
126+
s32 __iomem *io_virt_addr = atomisp_io_base + (addr & 0x003FFFFF);
121127
unsigned long flags;
122128
u32 ret;
123129

124130
spin_lock_irqsave(&mmio_lock, flags);
125-
ret = _hrt_master_port_load_32(addr);
131+
ret = *io_virt_addr;
126132
spin_unlock_irqrestore(&mmio_lock, flags);
127133
return ret;
128134
}
129135

130136
static void atomisp_css2_hw_store(hrt_address addr,
131137
const void *from, uint32_t n)
132138
{
139+
s8 __iomem *io_virt_addr = atomisp_io_base + (addr & 0x003FFFFF);
133140
unsigned long flags;
134141
unsigned int i;
135-
unsigned int _to = (unsigned int)addr;
136-
const char *_from = (const char *)from;
137142

138143
spin_lock_irqsave(&mmio_lock, flags);
139-
for (i = 0; i < n; i++, _to++, _from++)
140-
_hrt_master_port_store_8(_to, *_from);
144+
for (i = 0; i < n; i++, io_virt_addr++, from++)
145+
*io_virt_addr = *(s8 *)from;
141146
spin_unlock_irqrestore(&mmio_lock, flags);
142147
}
143148

144149
static void atomisp_css2_hw_load(hrt_address addr, void *to, uint32_t n)
145150
{
151+
s8 __iomem *io_virt_addr = atomisp_io_base + (addr & 0x003FFFFF);
146152
unsigned long flags;
147153
unsigned int i;
148-
char *_to = (char *)to;
149-
unsigned int _from = (unsigned int)addr;
150154

151155
spin_lock_irqsave(&mmio_lock, flags);
152-
for (i = 0; i < n; i++, _to++, _from++)
153-
*_to = _hrt_master_port_load_8(_from);
156+
for (i = 0; i < n; i++, to++, io_virt_addr++)
157+
*(s8 *)to = *io_virt_addr;
154158
spin_unlock_irqrestore(&mmio_lock, flags);
155159
}
156160

@@ -992,9 +996,9 @@ void atomisp_css_rx_clear_irq_info(enum mipi_port_id port,
992996
int atomisp_css_irq_enable(struct atomisp_device *isp,
993997
enum ia_css_irq_info info, bool enable)
994998
{
995-
dev_dbg(isp->dev, "%s: css irq info 0x%08x: %s.\n",
999+
dev_dbg(isp->dev, "%s: css irq info 0x%08x: %s (%d).\n",
9961000
__func__, info,
997-
enable ? "enable" : "disable");
1001+
enable ? "enable" : "disable", enable);
9981002
if (ia_css_irq_enable(info, enable)) {
9991003
dev_warn(isp->dev, "%s:Invalid irq info: 0x%08x when %s.\n",
10001004
__func__, info,
@@ -4292,8 +4296,13 @@ bool atomisp_css_valid_sof(struct atomisp_device *isp)
42924296
struct atomisp_sub_device *asd = &isp->asd[i];
42934297
/* Loop for each css vc stream */
42944298
for (j = 0; j < ATOMISP_INPUT_STREAM_NUM; j++) {
4295-
if (asd->stream_env[j].stream &&
4296-
asd->stream_env[j].stream_config.mode ==
4299+
if (!asd->stream_env[j].stream)
4300+
continue;
4301+
4302+
dev_dbg(isp->dev,
4303+
"stream #%d: mode: %d\n", j,
4304+
asd->stream_env[j].stream_config.mode);
4305+
if (asd->stream_env[j].stream_config.mode ==
42974306
IA_CSS_INPUT_MODE_BUFFERED_SENSOR)
42984307
return false;
42994308
}

drivers/staging/media/atomisp/pci/atomisp_helper.h

Lines changed: 0 additions & 29 deletions
This file was deleted.

drivers/staging/media/atomisp/pci/hive_isp_css_common/host/irq.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
#endif
2222
#include "gp_device.h" /* _REG_GP_IRQ_REQUEST_ADDR */
2323

24-
#include "platform_support.h" /* hrt_sleep() */
25-
2624
static inline void irq_wait_for_write_complete(
2725
const irq_ID_t ID);
2826

drivers/staging/media/atomisp/pci/hive_isp_css_common/host/isp.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
* more details.
1414
*/
1515

16+
#include <linux/delay.h>
17+
1618
#include <system_global.h>
1719
#include "isp.h"
1820

@@ -21,7 +23,6 @@
2123
#endif /* __INLINE_ISP__ */
2224

2325
#include "assert_support.h"
24-
#include "platform_support.h" /* hrt_sleep() */
2526

2627
void cnd_isp_irq_enable(
2728
const isp_ID_t ID,
@@ -125,5 +126,5 @@ void isp_wake(isp_ID_t ID)
125126
{
126127
assert(ID < N_ISP_ID);
127128
isp_ctrl_setbit(ID, ISP_SC_REG, ISP_START_BIT);
128-
hrt_sleep();
129+
udelay(1);
129130
}

drivers/staging/media/atomisp/pci/hive_isp_css_common/host/vmem.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#include "ia_css_device_access.h"
2222
#endif
2323
#include "assert_support.h"
24-
#include "platform_support.h" /* hrt_sleep() */
2524

2625
typedef unsigned long long hive_uedge;
2726
typedef hive_uedge *hive_wide;
@@ -155,7 +154,7 @@ static void load_vector(
155154
hive_sim_wide_unpack(data, &elem, ISP_VEC_ELEMBITS, i);
156155
to[i] = elem;
157156
}
158-
hrt_sleep(); /* Spend at least 1 cycles per vector */
157+
udelay(1); /* Spend at least 1 cycles per vector */
159158
}
160159

161160
static void store_vector(
@@ -180,7 +179,7 @@ static void store_vector(
180179
//hrt_mem_store (ISP, VMEM, (unsigned)to, &v, siz); /* This will overwrite the next vector as well */
181180
hrt_master_port_store(ISP_BAMEM_BASE[ID] + (unsigned long)to, &v, size);
182181
#endif
183-
hrt_sleep(); /* Spend at least 1 cycles per vector */
182+
udelay(1); /* Spend at least 1 cycles per vector */
184183
}
185184

186185
void isp_vmem_load(

drivers/staging/media/atomisp/pci/hive_isp_css_include/platform_support.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@
2525
#include <linux/kernel.h>
2626
#include <linux/string.h>
2727

28-
/* For definition of hrt_sleep() */
29-
#include "hive_isp_css_custom_host_hrt.h"
30-
3128
#define UINT16_MAX USHRT_MAX
3229
#define UINT32_MAX UINT_MAX
3330
#define UCHAR_MAX (255)

drivers/staging/media/atomisp/pci/hrt/hive_isp_css_custom_host_hrt.h

Lines changed: 0 additions & 107 deletions
This file was deleted.

0 commit comments

Comments
 (0)