Commit c3cdc019 authored by Deepak R Varma's avatar Deepak R Varma Committed by Mauro Carvalho Chehab

media: atomisp: pci: reposition braces as per coding style

Misplaced braces makes it difficult to follow the code easily. This also
goes against the code style guidelines. This resolved following checkpatch
complaints:

ERROR: open brace '{' following function definitions go on the next line
ERROR: that open brace { should be on the previous line

Link: https://lore.kernel.org/linux-media/YIwk3KbVGRPJwKa4@dU2104

[mchehab: dropped a hunk with a merge conflict]
Cc: linux-media@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, drv@mailo.com # X-LSpam-Score: -7.3 (-------)
Signed-off-by: default avatarDeepak R Varma <drv@mailo.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent f83f86e7
...@@ -91,7 +91,8 @@ ia_css_mipi_frame_calculate_size(const unsigned int width, ...@@ -91,7 +91,8 @@ ia_css_mipi_frame_calculate_size(const unsigned int width,
const enum atomisp_input_format format, const enum atomisp_input_format format,
const bool hasSOLandEOL, const bool hasSOLandEOL,
const unsigned int embedded_data_size_words, const unsigned int embedded_data_size_words,
unsigned int *size_mem_words) { unsigned int *size_mem_words)
{
int err = 0; int err = 0;
unsigned int bits_per_pixel = 0; unsigned int bits_per_pixel = 0;
...@@ -118,8 +119,7 @@ ia_css_mipi_frame_calculate_size(const unsigned int width, ...@@ -118,8 +119,7 @@ ia_css_mipi_frame_calculate_size(const unsigned int width,
IA_CSS_ENTER("padded_width=%d, height=%d, format=%d, hasSOLandEOL=%d, embedded_data_size_words=%d\n", IA_CSS_ENTER("padded_width=%d, height=%d, format=%d, hasSOLandEOL=%d, embedded_data_size_words=%d\n",
width_padded, height, format, hasSOLandEOL, embedded_data_size_words); width_padded, height, format, hasSOLandEOL, embedded_data_size_words);
switch (format) switch (format) {
{
case ATOMISP_INPUT_FORMAT_RAW_6: /* 4p, 3B, 24bits */ case ATOMISP_INPUT_FORMAT_RAW_6: /* 4p, 3B, 24bits */
bits_per_pixel = 6; bits_per_pixel = 6;
break; break;
...@@ -178,12 +178,10 @@ ia_css_mipi_frame_calculate_size(const unsigned int width, ...@@ -178,12 +178,10 @@ ia_css_mipi_frame_calculate_size(const unsigned int width,
/* Even lines for YUV420 formats are double in bits_per_pixel. */ /* Even lines for YUV420 formats are double in bits_per_pixel. */
if (format == ATOMISP_INPUT_FORMAT_YUV420_8 if (format == ATOMISP_INPUT_FORMAT_YUV420_8
|| format == ATOMISP_INPUT_FORMAT_YUV420_10 || format == ATOMISP_INPUT_FORMAT_YUV420_10
|| format == ATOMISP_INPUT_FORMAT_YUV420_16) || format == ATOMISP_INPUT_FORMAT_YUV420_16) {
{
even_line_bytes = (width_padded * 2 * bits_per_pixel + 7) >> even_line_bytes = (width_padded * 2 * bits_per_pixel + 7) >>
3; /* ceil ( bits per line / 8) */ 3; /* ceil ( bits per line / 8) */
} else } else {
{
even_line_bytes = odd_line_bytes; even_line_bytes = odd_line_bytes;
} }
...@@ -236,7 +234,8 @@ ia_css_mipi_frame_calculate_size(const unsigned int width, ...@@ -236,7 +234,8 @@ ia_css_mipi_frame_calculate_size(const unsigned int width,
#if !defined(ISP2401) #if !defined(ISP2401)
int int
ia_css_mipi_frame_enable_check_on_size(const enum mipi_port_id port, ia_css_mipi_frame_enable_check_on_size(const enum mipi_port_id port,
const unsigned int size_mem_words) { const unsigned int size_mem_words)
{
u32 idx; u32 idx;
int err = -EBUSY; int err = -EBUSY;
...@@ -246,11 +245,9 @@ ia_css_mipi_frame_enable_check_on_size(const enum mipi_port_id port, ...@@ -246,11 +245,9 @@ ia_css_mipi_frame_enable_check_on_size(const enum mipi_port_id port,
for (idx = 0; idx < IA_CSS_MIPI_SIZE_CHECK_MAX_NOF_ENTRIES_PER_PORT && for (idx = 0; idx < IA_CSS_MIPI_SIZE_CHECK_MAX_NOF_ENTRIES_PER_PORT &&
my_css.mipi_sizes_for_check[port][idx] != 0; my_css.mipi_sizes_for_check[port][idx] != 0;
idx++) /* do nothing */ idx++) { /* do nothing */
{
} }
if (idx < IA_CSS_MIPI_SIZE_CHECK_MAX_NOF_ENTRIES_PER_PORT) if (idx < IA_CSS_MIPI_SIZE_CHECK_MAX_NOF_ENTRIES_PER_PORT) {
{
my_css.mipi_sizes_for_check[port][idx] = size_mem_words; my_css.mipi_sizes_for_check[port][idx] = size_mem_words;
err = 0; err = 0;
} }
...@@ -271,7 +268,8 @@ mipi_init(void) ...@@ -271,7 +268,8 @@ mipi_init(void)
int int
calculate_mipi_buff_size( calculate_mipi_buff_size(
struct ia_css_stream_config *stream_cfg, struct ia_css_stream_config *stream_cfg,
unsigned int *size_mem_words) { unsigned int *size_mem_words)
{
#if !defined(ISP2401) #if !defined(ISP2401)
int err = -EINVAL; int err = -EINVAL;
(void)stream_cfg; (void)stream_cfg;
...@@ -346,12 +344,10 @@ calculate_mipi_buff_size( ...@@ -346,12 +344,10 @@ calculate_mipi_buff_size(
/* Even lines for YUV420 formats are double in bits_per_pixel. */ /* Even lines for YUV420 formats are double in bits_per_pixel. */
if (format == ATOMISP_INPUT_FORMAT_YUV420_8 if (format == ATOMISP_INPUT_FORMAT_YUV420_8
|| format == ATOMISP_INPUT_FORMAT_YUV420_10) || format == ATOMISP_INPUT_FORMAT_YUV420_10) {
{
even_line_bytes = (width_padded * 2 * bits_per_pixel + 7) >> even_line_bytes = (width_padded * 2 * bits_per_pixel + 7) >>
3; /* ceil ( bits per line / 8) */ 3; /* ceil ( bits per line / 8) */
} else } else {
{
even_line_bytes = odd_line_bytes; even_line_bytes = odd_line_bytes;
} }
...@@ -393,7 +389,8 @@ static bool buffers_needed(struct ia_css_pipe *pipe) ...@@ -393,7 +389,8 @@ static bool buffers_needed(struct ia_css_pipe *pipe)
int int
allocate_mipi_frames(struct ia_css_pipe *pipe, allocate_mipi_frames(struct ia_css_pipe *pipe,
struct ia_css_stream_info *info) { struct ia_css_stream_info *info)
{
int err = -EINVAL; int err = -EINVAL;
unsigned int port; unsigned int port;
...@@ -402,8 +399,7 @@ allocate_mipi_frames(struct ia_css_pipe *pipe, ...@@ -402,8 +399,7 @@ allocate_mipi_frames(struct ia_css_pipe *pipe,
assert(pipe); assert(pipe);
assert(pipe->stream); assert(pipe->stream);
if ((!pipe) || (!pipe->stream)) if ((!pipe) || (!pipe->stream)) {
{
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE, ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE,
"allocate_mipi_frames(%p) exit: pipe or stream is null.\n", "allocate_mipi_frames(%p) exit: pipe or stream is null.\n",
pipe); pipe);
...@@ -411,8 +407,7 @@ allocate_mipi_frames(struct ia_css_pipe *pipe, ...@@ -411,8 +407,7 @@ allocate_mipi_frames(struct ia_css_pipe *pipe,
} }
#ifdef ISP2401 #ifdef ISP2401
if (pipe->stream->config.online) if (pipe->stream->config.online) {
{
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE, ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE,
"allocate_mipi_frames(%p) exit: no buffers needed for 2401 pipe mode.\n", "allocate_mipi_frames(%p) exit: no buffers needed for 2401 pipe mode.\n",
pipe); pipe);
...@@ -449,8 +444,7 @@ allocate_mipi_frames(struct ia_css_pipe *pipe, ...@@ -449,8 +444,7 @@ allocate_mipi_frames(struct ia_css_pipe *pipe,
#endif #endif
#if !defined(ISP2401) #if !defined(ISP2401)
if (ref_count_mipi_allocation[port] != 0) if (ref_count_mipi_allocation[port] != 0) {
{
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE, ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE,
"allocate_mipi_frames(%p) exit: already allocated for this port (port=%d).\n", "allocate_mipi_frames(%p) exit: already allocated for this port (port=%d).\n",
pipe, port); pipe, port);
...@@ -462,8 +456,7 @@ allocate_mipi_frames(struct ia_css_pipe *pipe, ...@@ -462,8 +456,7 @@ allocate_mipi_frames(struct ia_css_pipe *pipe,
* TODO AM: Once that is changed (removed) this code should be removed as well. * TODO AM: Once that is changed (removed) this code should be removed as well.
* In that case only 2400 related code should remain. * In that case only 2400 related code should remain.
*/ */
if (ref_count_mipi_allocation[port] != 0) if (ref_count_mipi_allocation[port] != 0) {
{
ref_count_mipi_allocation[port]++; ref_count_mipi_allocation[port]++;
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE, ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE,
"allocate_mipi_frames(%p) leave: nothing to do, already allocated for this port (port=%d).\n", "allocate_mipi_frames(%p) leave: nothing to do, already allocated for this port (port=%d).\n",
...@@ -481,8 +474,7 @@ allocate_mipi_frames(struct ia_css_pipe *pipe, ...@@ -481,8 +474,7 @@ allocate_mipi_frames(struct ia_css_pipe *pipe,
{ /* limit the scope of i,j */ { /* limit the scope of i,j */
unsigned int i, j; unsigned int i, j;
for (i = 0; i < my_css.num_mipi_frames[port]; i++) for (i = 0; i < my_css.num_mipi_frames[port]; i++) {
{
/* free previous frame */ /* free previous frame */
if (my_css.mipi_frames[port][i]) { if (my_css.mipi_frames[port][i]) {
ia_css_frame_free(my_css.mipi_frames[port][i]); ia_css_frame_free(my_css.mipi_frames[port][i]);
...@@ -535,7 +527,8 @@ allocate_mipi_frames(struct ia_css_pipe *pipe, ...@@ -535,7 +527,8 @@ allocate_mipi_frames(struct ia_css_pipe *pipe,
} }
int int
free_mipi_frames(struct ia_css_pipe *pipe) { free_mipi_frames(struct ia_css_pipe *pipe)
{
int err = -EINVAL; int err = -EINVAL;
unsigned int port; unsigned int port;
...@@ -543,8 +536,7 @@ free_mipi_frames(struct ia_css_pipe *pipe) { ...@@ -543,8 +536,7 @@ free_mipi_frames(struct ia_css_pipe *pipe) {
"free_mipi_frames(%p) enter:\n", pipe); "free_mipi_frames(%p) enter:\n", pipe);
/* assert(pipe != NULL); TEMP: TODO: Should be assert only. */ /* assert(pipe != NULL); TEMP: TODO: Should be assert only. */
if (pipe) if (pipe) {
{
assert(pipe->stream); assert(pipe->stream);
if ((!pipe) || (!pipe->stream)) { if ((!pipe) || (!pipe->stream)) {
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE, ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE,
...@@ -620,8 +612,7 @@ free_mipi_frames(struct ia_css_pipe *pipe) { ...@@ -620,8 +612,7 @@ free_mipi_frames(struct ia_css_pipe *pipe) {
} }
#endif #endif
} }
} else /* pipe ==NULL */ } else { /* pipe ==NULL */
{
/* AM TEMP: free-ing all mipi buffers just like a legacy code. */ /* AM TEMP: free-ing all mipi buffers just like a legacy code. */
for (port = CSI_PORT0_ID; port < N_CSI_PORTS; port++) { for (port = CSI_PORT0_ID; port < N_CSI_PORTS; port++) {
unsigned int i; unsigned int i;
...@@ -645,7 +636,8 @@ free_mipi_frames(struct ia_css_pipe *pipe) { ...@@ -645,7 +636,8 @@ free_mipi_frames(struct ia_css_pipe *pipe) {
} }
int int
send_mipi_frames(struct ia_css_pipe *pipe) { send_mipi_frames(struct ia_css_pipe *pipe)
{
int err = -EINVAL; int err = -EINVAL;
unsigned int i; unsigned int i;
#ifndef ISP2401 #ifndef ISP2401
...@@ -658,8 +650,7 @@ send_mipi_frames(struct ia_css_pipe *pipe) { ...@@ -658,8 +650,7 @@ send_mipi_frames(struct ia_css_pipe *pipe) {
assert(pipe); assert(pipe);
assert(pipe->stream); assert(pipe->stream);
if (!pipe || !pipe->stream) if (!pipe || !pipe->stream) {
{
IA_CSS_ERROR("pipe or stream is null"); IA_CSS_ERROR("pipe or stream is null");
return -EINVAL; return -EINVAL;
} }
...@@ -686,8 +677,7 @@ send_mipi_frames(struct ia_css_pipe *pipe) { ...@@ -686,8 +677,7 @@ send_mipi_frames(struct ia_css_pipe *pipe) {
} }
/* Hand-over the SP-internal mipi buffers */ /* Hand-over the SP-internal mipi buffers */
for (i = 0; i < my_css.num_mipi_frames[port]; i++) for (i = 0; i < my_css.num_mipi_frames[port]; i++) {
{
/* Need to include the ofset for port. */ /* Need to include the ofset for port. */
sh_css_update_host2sp_mipi_frame(port * NUM_MIPI_FRAMES_PER_STREAM + i, sh_css_update_host2sp_mipi_frame(port * NUM_MIPI_FRAMES_PER_STREAM + i,
my_css.mipi_frames[port][i]); my_css.mipi_frames[port][i]);
...@@ -700,8 +690,7 @@ send_mipi_frames(struct ia_css_pipe *pipe) { ...@@ -700,8 +690,7 @@ send_mipi_frames(struct ia_css_pipe *pipe) {
* Send an event to inform the SP * Send an event to inform the SP
* that all MIPI frames are passed. * that all MIPI frames are passed.
**********************************/ **********************************/
if (!sh_css_sp_is_running()) if (!sh_css_sp_is_running()) {
{
/* SP is not running. The queues are not valid */ /* SP is not running. The queues are not valid */
IA_CSS_ERROR("sp is not running"); IA_CSS_ERROR("sp is not running");
return err; return err;
......
...@@ -21,7 +21,8 @@ ...@@ -21,7 +21,8 @@
#include "sh_css_firmware.h" #include "sh_css_firmware.h"
int int
ia_css_get_version(char *version, int max_size) { ia_css_get_version(char *version, int max_size)
{
char *css_version; char *css_version;
if (!IS_ISP2401) if (!IS_ISP2401)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment