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

media: staging: media: atomisp: code formatting changes atomisp_csi2.c

Several trivial code reformatting changes done according to the coding
style guidelines. These changes improves code organisation and readability
and also 4 address many chackpatch error, warning and check complaints.
Signed-off-by: default avatarDeepak R Varma <drv@mailo.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent de27891f
...@@ -22,13 +22,11 @@ ...@@ -22,13 +22,11 @@
#include "atomisp_internal.h" #include "atomisp_internal.h"
#include "atomisp-regs.h" #include "atomisp-regs.h"
static struct v4l2_mbus_framefmt *__csi2_get_format(struct static struct
atomisp_mipi_csi2_device v4l2_mbus_framefmt *__csi2_get_format(struct atomisp_mipi_csi2_device *csi2,
* csi2, struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_state *sd_state, enum v4l2_subdev_format_whence which,
enum unsigned int pad)
v4l2_subdev_format_whence
which, unsigned int pad)
{ {
if (which == V4L2_SUBDEV_FORMAT_TRY) if (which == V4L2_SUBDEV_FORMAT_TRY)
return v4l2_subdev_get_try_format(&csi2->subdev, sd_state, return v4l2_subdev_get_try_format(&csi2->subdev, sd_state,
...@@ -43,7 +41,7 @@ static struct v4l2_mbus_framefmt *__csi2_get_format(struct ...@@ -43,7 +41,7 @@ static struct v4l2_mbus_framefmt *__csi2_get_format(struct
* @fh : V4L2 subdev file handle * @fh : V4L2 subdev file handle
* @code : pointer to v4l2_subdev_pad_mbus_code_enum structure * @code : pointer to v4l2_subdev_pad_mbus_code_enum structure
* return -EINVAL or zero on success * return -EINVAL or zero on success
*/ */
static int csi2_enum_mbus_code(struct v4l2_subdev *sd, static int csi2_enum_mbus_code(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state, struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_mbus_code_enum *code) struct v4l2_subdev_mbus_code_enum *code)
...@@ -69,7 +67,7 @@ static int csi2_enum_mbus_code(struct v4l2_subdev *sd, ...@@ -69,7 +67,7 @@ static int csi2_enum_mbus_code(struct v4l2_subdev *sd,
* @pad: pad num * @pad: pad num
* @fmt: pointer to v4l2 format structure * @fmt: pointer to v4l2 format structure
* return -EINVAL or zero on success * return -EINVAL or zero on success
*/ */
static int csi2_get_format(struct v4l2_subdev *sd, static int csi2_get_format(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state, struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_format *fmt) struct v4l2_subdev_format *fmt)
...@@ -104,12 +102,12 @@ int atomisp_csi2_set_ffmt(struct v4l2_subdev *sd, ...@@ -104,12 +102,12 @@ int atomisp_csi2_set_ffmt(struct v4l2_subdev *sd,
else else
actual_ffmt->code = atomisp_in_fmt_conv[0].code; actual_ffmt->code = atomisp_in_fmt_conv[0].code;
actual_ffmt->width = clamp_t( actual_ffmt->width = clamp_t(u32, ffmt->width,
u32, ffmt->width, ATOM_ISP_MIN_WIDTH, ATOM_ISP_MIN_WIDTH,
ATOM_ISP_MAX_WIDTH); ATOM_ISP_MAX_WIDTH);
actual_ffmt->height = clamp_t( actual_ffmt->height = clamp_t(u32, ffmt->height,
u32, ffmt->height, ATOM_ISP_MIN_HEIGHT, ATOM_ISP_MIN_HEIGHT,
ATOM_ISP_MAX_HEIGHT); ATOM_ISP_MAX_HEIGHT);
tmp_ffmt = *ffmt = *actual_ffmt; tmp_ffmt = *ffmt = *actual_ffmt;
...@@ -132,7 +130,7 @@ int atomisp_csi2_set_ffmt(struct v4l2_subdev *sd, ...@@ -132,7 +130,7 @@ int atomisp_csi2_set_ffmt(struct v4l2_subdev *sd,
* @pad: pad num * @pad: pad num
* @fmt: pointer to v4l2 format structure * @fmt: pointer to v4l2 format structure
* return -EINVAL or zero on success * return -EINVAL or zero on success
*/ */
static int csi2_set_format(struct v4l2_subdev *sd, static int csi2_set_format(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state, struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_format *fmt) struct v4l2_subdev_format *fmt)
...@@ -147,7 +145,7 @@ static int csi2_set_format(struct v4l2_subdev *sd, ...@@ -147,7 +145,7 @@ static int csi2_set_format(struct v4l2_subdev *sd,
* @enable: Enable/disable stream (1/0) * @enable: Enable/disable stream (1/0)
* *
* Return 0 on success or a negative error code otherwise. * Return 0 on success or a negative error code otherwise.
*/ */
static int csi2_set_stream(struct v4l2_subdev *sd, int enable) static int csi2_set_stream(struct v4l2_subdev *sd, int enable)
{ {
return 0; return 0;
...@@ -184,7 +182,7 @@ static const struct v4l2_subdev_ops csi2_ops = { ...@@ -184,7 +182,7 @@ static const struct v4l2_subdev_ops csi2_ops = {
* @remote : Pointer to remote pad array * @remote : Pointer to remote pad array
* @flags : Link flags * @flags : Link flags
* return -EINVAL or zero on success * return -EINVAL or zero on success
*/ */
static int csi2_link_setup(struct media_entity *entity, static int csi2_link_setup(struct media_entity *entity,
const struct media_pad *local, const struct media_pad *local,
const struct media_pad *remote, u32 flags) const struct media_pad *remote, u32 flags)
...@@ -222,10 +220,10 @@ static const struct media_entity_operations csi2_media_ops = { ...@@ -222,10 +220,10 @@ static const struct media_entity_operations csi2_media_ops = {
}; };
/* /*
* ispcsi2_init_entities - Initialize subdev and media entity. * ispcsi2_init_entities - Initialize subdev and media entity.
* @csi2: Pointer to ispcsi2 structure. * @csi2: Pointer to ispcsi2 structure.
* return -ENOMEM or zero on success * return -ENOMEM or zero on success
*/ */
static int mipi_csi2_init_entities(struct atomisp_mipi_csi2_device *csi2, static int mipi_csi2_init_entities(struct atomisp_mipi_csi2_device *csi2,
int port) int port)
{ {
...@@ -249,9 +247,8 @@ static int mipi_csi2_init_entities(struct atomisp_mipi_csi2_device *csi2, ...@@ -249,9 +247,8 @@ static int mipi_csi2_init_entities(struct atomisp_mipi_csi2_device *csi2,
if (ret < 0) if (ret < 0)
return ret; return ret;
csi2->formats[CSI2_PAD_SINK].code = csi2->formats[CSI2_PAD_SINK].code = atomisp_in_fmt_conv[0].code;
csi2->formats[CSI2_PAD_SOURCE].code = csi2->formats[CSI2_PAD_SOURCE].code = atomisp_in_fmt_conv[0].code;
atomisp_in_fmt_conv[0].code;
return 0; return 0;
} }
...@@ -379,21 +376,22 @@ static void atomisp_csi2_configure_isp2401(struct atomisp_sub_device *asd) ...@@ -379,21 +376,22 @@ static void atomisp_csi2_configure_isp2401(struct atomisp_sub_device *asd)
(isp->inputs[asd->input_curr].camera->ctrl_handler, &ctrl) == 0) (isp->inputs[asd->input_curr].camera->ctrl_handler, &ctrl) == 0)
mipi_freq = ctrl.value; mipi_freq = ctrl.value;
clk_termen = atomisp_csi2_configure_calc(coeff_clk_termen, clk_termen = atomisp_csi2_configure_calc(coeff_clk_termen, mipi_freq,
mipi_freq, TERMEN_DEFAULT); TERMEN_DEFAULT);
clk_settle = atomisp_csi2_configure_calc(coeff_clk_settle, clk_settle = atomisp_csi2_configure_calc(coeff_clk_settle, mipi_freq,
mipi_freq, SETTLE_DEFAULT); SETTLE_DEFAULT);
dat_termen = atomisp_csi2_configure_calc(coeff_dat_termen, dat_termen = atomisp_csi2_configure_calc(coeff_dat_termen, mipi_freq,
mipi_freq, TERMEN_DEFAULT); TERMEN_DEFAULT);
dat_settle = atomisp_csi2_configure_calc(coeff_dat_settle, dat_settle = atomisp_csi2_configure_calc(coeff_dat_settle, mipi_freq,
mipi_freq, SETTLE_DEFAULT); SETTLE_DEFAULT);
for (n = 0; n < csi2_port_lanes[port] + 1; n++) { for (n = 0; n < csi2_port_lanes[port] + 1; n++) {
hrt_address base = csi2_port_base[port] + csi2_lane_base[n]; hrt_address base = csi2_port_base[port] + csi2_lane_base[n];
atomisp_css2_hw_store_32(base + CSI2_REG_RX_CSI_DLY_CNT_TERMEN, atomisp_css2_hw_store_32(base + CSI2_REG_RX_CSI_DLY_CNT_TERMEN,
n == 0 ? clk_termen : dat_termen); n == 0 ? clk_termen : dat_termen);
atomisp_css2_hw_store_32(base + CSI2_REG_RX_CSI_DLY_CNT_SETTLE, atomisp_css2_hw_store_32(base + CSI2_REG_RX_CSI_DLY_CNT_SETTLE,
n == 0 ? clk_settle : dat_settle); n == 0 ? clk_settle : dat_settle);
} }
} }
...@@ -405,7 +403,7 @@ void atomisp_csi2_configure(struct atomisp_sub_device *asd) ...@@ -405,7 +403,7 @@ void atomisp_csi2_configure(struct atomisp_sub_device *asd)
/* /*
* atomisp_mipi_csi2_cleanup - Routine for module driver cleanup * atomisp_mipi_csi2_cleanup - Routine for module driver cleanup
*/ */
void atomisp_mipi_csi2_cleanup(struct atomisp_device *isp) void atomisp_mipi_csi2_cleanup(struct atomisp_device *isp)
{ {
} }
......
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