From 95099d4622f8cb224d94e314c7a8e0df60b13f87 Mon Sep 17 00:00:00 2001
From: hc <hc@nodka.com>
Date: Sat, 09 Dec 2023 08:38:01 +0000
Subject: [PATCH] enable docker ppp
---
kernel/drivers/media/i2c/sc530ai.c | 253 +++++++++++++++++++++++++++++++-------------------
1 files changed, 157 insertions(+), 96 deletions(-)
diff --git a/kernel/drivers/media/i2c/sc530ai.c b/kernel/drivers/media/i2c/sc530ai.c
index 4ffffda..6725245 100644
--- a/kernel/drivers/media/i2c/sc530ai.c
+++ b/kernel/drivers/media/i2c/sc530ai.c
@@ -8,6 +8,7 @@
* V0.0X01.0X01 fix set vflip/hflip failed bug.
*/
+//#define DEBUG
#include <linux/clk.h>
#include <linux/device.h>
#include <linux/delay.h>
@@ -59,7 +60,7 @@
#define SC530AI_XVCLK_FREQ 27000000
-#define SC530AI_CHIP_ID 0x9e39
+#define SC530AI_CHIP_ID 0x8e39
#define SC530AI_REG_CHIP_ID 0x3107
#define SC530AI_REG_CTRL_MODE 0x0100
@@ -77,10 +78,10 @@
#define SC530AI_REG_DIG_FINE_GAIN 0x3e07
#define SC530AI_REG_ANA_GAIN 0x3e09
-#define SC530AI_GAIN_MIN 0x800
-#define SC530AI_GAIN_MAX 0xa3300
+#define SC530AI_GAIN_MIN 0x20
+#define SC530AI_GAIN_MAX (32 * 326)
#define SC530AI_GAIN_STEP 1
-#define SC530AI_GAIN_DEFAULT 0x800
+#define SC530AI_GAIN_DEFAULT 0x20
#define SC530AI_REG_VTS_H 0x320e
#define SC530AI_REG_VTS_L 0x320f
@@ -139,14 +140,6 @@
#define sc530ai_NUM_SUPPLIES ARRAY_SIZE(sc530ai_supply_names)
-enum sc530ai_max_pad {
- PAD0, /* link to isp */
- PAD1, /* link to csi wr0 | hdr x2:L x3:M */
- PAD2, /* link to csi wr1 | hdr x3:L */
- PAD3, /* link to csi wr2 | hdr x2:M x3:S */
- PAD_MAX,
-};
-
struct regval {
u16 addr;
u8 val;
@@ -177,7 +170,8 @@
struct pinctrl *pinctrl;
struct pinctrl_state *pins_default;
struct pinctrl_state *pins_sleep;
-
+ struct v4l2_fract cur_fps;
+ u32 cur_vts;
struct v4l2_subdev subdev;
struct media_pad pad;
struct v4l2_ctrl_handler ctrl_handler;
@@ -191,7 +185,9 @@
struct mutex mutex;
bool streaming;
bool power_on;
+ const struct sc530ai_mode *support_modes;
const struct sc530ai_mode *cur_mode;
+ u32 support_modes_num;
unsigned int lane_num;
u32 module_index;
const char *module_facing;
@@ -208,7 +204,7 @@
* max_framerate 30fps
* mipi_datarate per lane 1008Mbps, 4lane
*/
-static const struct regval sc530ai_linear_10_30fps_2880x1620_regs[] = {
+static const struct regval sc530ai_linear_10_30fps_2880x1620_4lane_regs[] = {
{0x0103, 0x01},
{0x0100, 0x00},
{0x36e9, 0x80},
@@ -317,6 +313,7 @@
{0x3e02, 0xa0},
{0x440e, 0x02},
{0x4509, 0x20},
+ {0x4800, 0x04},
{0x4837, 0x28},
{0x5010, 0x10},
{0x5799, 0x06},
@@ -356,7 +353,7 @@
{REG_NULL, 0x00},
};
-static const struct regval sc530ai_hdr_10_30fps_2880x1620_regs[] = {
+static const struct regval sc530ai_hdr_10_30fps_2880x1620_4lane_regs[] = {
{0x0103, 0x01},
{0x0100, 0x00},
{0x36e9, 0x80},
@@ -471,6 +468,7 @@
{0x3e24, 0xc8},
{0x440e, 0x02},
{0x4509, 0x20},
+ {0x4800, 0x04},
{0x4816, 0x11},
{0x5010, 0x10},
{0x5799, 0x06},
@@ -626,6 +624,7 @@
{0x3e02, 0xa0},
{0x440e, 0x02},
{0x4509, 0x20},
+ {0x4800, 0x04},
{0x4837, 0x14},
{0x5010, 0x10},
{0x5799, 0x06},
@@ -664,7 +663,7 @@
{REG_NULL, 0x00},
};
-static const struct sc530ai_mode supported_modes[] = {
+static const struct sc530ai_mode supported_modes_4lane[] = {
{
.width = 2880,
.height = 1620,
@@ -676,7 +675,7 @@
.hts_def = 0xb40,
.vts_def = 0x0672,
.bus_fmt = MEDIA_BUS_FMT_SBGGR10_1X10,
- .reg_list = sc530ai_linear_10_30fps_2880x1620_regs,
+ .reg_list = sc530ai_linear_10_30fps_2880x1620_4lane_regs,
.mipi_freq_idx = 0,
.bpp = 10,
.hdr_mode = NO_HDR,
@@ -693,7 +692,7 @@
.hts_def = 0xb40,
.vts_def = 0x0ce4,
.bus_fmt = MEDIA_BUS_FMT_SBGGR10_1X10,
- .reg_list = sc530ai_hdr_10_30fps_2880x1620_regs,
+ .reg_list = sc530ai_hdr_10_30fps_2880x1620_4lane_regs,
.mipi_freq_idx = 1,
.bpp = 10,
.hdr_mode = HDR_X2,
@@ -702,7 +701,10 @@
.vc[PAD2] = V4L2_MBUS_CSI2_CHANNEL_1,
.vc[PAD3] = V4L2_MBUS_CSI2_CHANNEL_1,//M->csi wr2
},
- {
+};
+
+static const struct sc530ai_mode supported_modes_2lane[] = {
+{
.width = 2880,
.height = 1620,
.max_fps = {
@@ -812,7 +814,7 @@
}
static const struct sc530ai_mode *
-sc530ai_find_best_fit(struct v4l2_subdev_format *fmt)
+sc530ai_find_best_fit(struct sc530ai *sc530ai, struct v4l2_subdev_format *fmt)
{
struct v4l2_mbus_framefmt *framefmt = &fmt->format;
int dist;
@@ -820,15 +822,15 @@
int cur_best_fit_dist = -1;
unsigned int i;
- for (i = 0; i < ARRAY_SIZE(supported_modes); i++) {
- dist = sc530ai_get_reso_dist(&supported_modes[i], framefmt);
+ for (i = 0; i < sc530ai->support_modes_num; i++) {
+ dist = sc530ai_get_reso_dist(&sc530ai->support_modes[i], framefmt);
if (cur_best_fit_dist == -1 || dist < cur_best_fit_dist) {
cur_best_fit_dist = dist;
cur_best_fit = i;
}
}
- return &supported_modes[cur_best_fit];
+ return &sc530ai->support_modes[cur_best_fit];
}
static int sc530ai_set_fmt(struct v4l2_subdev *sd,
@@ -842,7 +844,7 @@
mutex_lock(&sc530ai->mutex);
- mode = sc530ai_find_best_fit(fmt);
+ mode = sc530ai_find_best_fit(sc530ai, fmt);
fmt->format.code = mode->bus_fmt;
fmt->format.width = mode->width;
fmt->format.height = mode->height;
@@ -869,6 +871,8 @@
pixel_rate = (u32)link_freq_items[mode->mipi_freq_idx] /
mode->bpp * 2 * sc530ai->lane_num;
__v4l2_ctrl_s_ctrl_int64(sc530ai->pixel_rate, pixel_rate);
+ sc530ai->cur_vts = mode->vts_def;
+ sc530ai->cur_fps = mode->max_fps;
}
mutex_unlock(&sc530ai->mutex);
@@ -924,16 +928,18 @@
struct v4l2_subdev_pad_config *cfg,
struct v4l2_subdev_frame_size_enum *fse)
{
- if (fse->index >= ARRAY_SIZE(supported_modes))
+ struct sc530ai *sc530ai = to_sc530ai(sd);
+
+ if (fse->index >= sc530ai->support_modes_num)
return -EINVAL;
- if (fse->code != supported_modes[0].bus_fmt)
+ if (fse->code != sc530ai->support_modes[fse->index].bus_fmt)
return -EINVAL;
- fse->min_width = supported_modes[fse->index].width;
- fse->max_width = supported_modes[fse->index].width;
- fse->max_height = supported_modes[fse->index].height;
- fse->min_height = supported_modes[fse->index].height;
+ fse->min_width = sc530ai->support_modes[fse->index].width;
+ fse->max_width = sc530ai->support_modes[fse->index].width;
+ fse->max_height = sc530ai->support_modes[fse->index].height;
+ fse->min_height = sc530ai->support_modes[fse->index].height;
return 0;
}
@@ -944,14 +950,15 @@
struct sc530ai *sc530ai = to_sc530ai(sd);
const struct sc530ai_mode *mode = sc530ai->cur_mode;
- mutex_lock(&sc530ai->mutex);
- fi->interval = mode->max_fps;
- mutex_unlock(&sc530ai->mutex);
+ if (sc530ai->streaming)
+ fi->interval = sc530ai->cur_fps;
+ else
+ fi->interval = mode->max_fps;
return 0;
}
-static int sc530ai_g_mbus_config(struct v4l2_subdev *sd,
+static int sc530ai_g_mbus_config(struct v4l2_subdev *sd, unsigned int pad_id,
struct v4l2_mbus_config *config)
{
struct sc530ai *sc530ai = to_sc530ai(sd);
@@ -965,7 +972,7 @@
if (mode->hdr_mode == HDR_X3)
val |= V4L2_MBUS_CSI2_CHANNEL_2;
- config->type = V4L2_MBUS_CSI2;
+ config->type = V4L2_MBUS_CSI2_DPHY;
config->flags = val;
return 0;
@@ -984,42 +991,50 @@
static void sc530ai_get_gain_reg(u32 total_gain, u32 *again, u32 *dgain,
u32 *dgain_fine)
{
- if (total_gain < 0x1000) { /* 1 - 2x gain */
+ u32 gain_factor = 0;
+
+ if (total_gain < SC530AI_GAIN_MIN)
+ total_gain = SC530AI_GAIN_MIN;
+ else if (total_gain > SC530AI_GAIN_MAX)
+ total_gain = SC530AI_GAIN_MAX;
+
+ gain_factor = total_gain * 1000 / 32;
+ if (gain_factor < 2000) { /* 1 - 2x gain */
*again = 0x00;
*dgain = 0x00;
- *dgain_fine = total_gain >> 4;
- } else if (total_gain < 0x1466) { /* 2x - 2.55x gain */
+ *dgain_fine = gain_factor * 128 / 1000;
+ } else if (gain_factor < 2550) { /* 2x - 2.55x gain */
*again = 0x01;
*dgain = 0x00;
- *dgain_fine = total_gain >> 5;
- } else if (total_gain < 0x28cc) { /* 2.55x - 5.1x gain */
+ *dgain_fine = gain_factor * 128 / 2000;
+ } else if (gain_factor < 2550 * 2) { /* 2.55x - 5.1x gain */
*again = 0x40;
*dgain = 0x00;
- *dgain_fine = total_gain * 0x80 / 0x1466;
- } else if (total_gain < 0x5198) { /* 5.1x - 10.2x gain */
+ *dgain_fine = gain_factor * 128 / 2550;
+ } else if (gain_factor < 2550 * 4) { /* 5.1x - 10.2x gain */
*again = 0x48;
*dgain = 0x00;
- *dgain_fine = (total_gain * 0x80 / 0x1466) >> 1;
- } else if (total_gain < 0xa330) { /* 10.2x - 20.4x gain */
+ *dgain_fine = gain_factor * 128 / 5110;
+ } else if (gain_factor < 2550 * 8) { /* 10.2x - 20.4x gain */
*again = 0x49;
*dgain = 0x00;
- *dgain_fine = (total_gain * 0x80 / 0x1466) >> 2;
- } else if (total_gain < 0x14660) { /* 20.4x - 40.8x gain */
+ *dgain_fine = gain_factor * 128 / 10200;
+ } else if (gain_factor < 2550 * 16) { /* 20.4x - 40.8x gain */
*again = 0x4B;
*dgain = 0x00;
- *dgain_fine = (total_gain * 0x80 / 0x1466) >> 3;
- } else if (total_gain < 0x28cc0) { /* 40.8x - 81.6x gain */
+ *dgain_fine = gain_factor * 128 / 20400;
+ } else if (gain_factor < 2550 * 32) { /* 40.8x - 81.6x gain */
*again = 0x4f;
*dgain = 0x00;
- *dgain_fine = (total_gain * 0x80 / 0x1466) >> 4;
- } else if (total_gain < 0x51980) { /* 81.6x - 163.2x gain */
+ *dgain_fine = gain_factor * 128 / 40800;
+ } else if (gain_factor < 2550 * 64) { /* 81.6x - 163.2x gain */
*again = 0x5f;
*dgain = 0x00;
- *dgain_fine = (total_gain * 0x80 / 0x1466) >> 5;
- } else if (total_gain < 0xa3300) { /* 163.2x - 326.4x gain */
+ *dgain_fine = gain_factor * 128 / 40800 / 2;
+ } else if (gain_factor < 2550 * 128) { /* 163.2x - 326.4x gain */
*again = 0x5f;
*dgain = 0x01;
- *dgain_fine = (total_gain * 0x80 / 0x1466) >> 6;
+ *dgain_fine = gain_factor * 128 / 40800 / 4;
}
}
@@ -1114,11 +1129,23 @@
return ret;
}
+static int sc530ai_get_channel_info(struct sc530ai *sc530ai, struct rkmodule_channel_info *ch_info)
+{
+ if (ch_info->index < PAD0 || ch_info->index >= PAD_MAX)
+ return -EINVAL;
+ ch_info->vc = sc530ai->cur_mode->vc[ch_info->index];
+ ch_info->width = sc530ai->cur_mode->width;
+ ch_info->height = sc530ai->cur_mode->height;
+ ch_info->bus_fmt = sc530ai->cur_mode->bus_fmt;
+ return 0;
+}
+
static long sc530ai_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
{
struct sc530ai *sc530ai = to_sc530ai(sd);
struct rkmodule_hdr_cfg *hdr;
const struct sc530ai_mode *mode;
+ struct rkmodule_channel_info *ch_info;
long ret = 0;
u32 i, h = 0, w;
@@ -1136,15 +1163,17 @@
break;
case RKMODULE_SET_HDR_CFG:
hdr = (struct rkmodule_hdr_cfg *)arg;
- w = sc530ai->cur_mode->mipi_freq_idx;
- for (i = 0; i < ARRAY_SIZE(supported_modes); i++) {
- if (w == supported_modes[i].mipi_freq_idx &&
- supported_modes[i].hdr_mode == hdr->hdr_mode) {
- sc530ai->cur_mode = &supported_modes[i];
+ w = sc530ai->cur_mode->width;
+ h = sc530ai->cur_mode->height;
+ for (i = 0; i < sc530ai->support_modes_num; i++) {
+ if (w == sc530ai->support_modes[i].width &&
+ h == sc530ai->support_modes[i].height &&
+ sc530ai->support_modes[i].hdr_mode == hdr->hdr_mode) {
+ sc530ai->cur_mode = &sc530ai->support_modes[i];
break;
}
}
- if (i == ARRAY_SIZE(supported_modes)) {
+ if (i == sc530ai->support_modes_num) {
dev_err(&sc530ai->client->dev,
"not find hdr mode:%d %dx%d config\n",
hdr->hdr_mode, w, h);
@@ -1169,7 +1198,8 @@
__v4l2_ctrl_s_ctrl_int64(sc530ai->pixel_rate,
pixel_rate);
-
+ sc530ai->cur_vts = mode->vts_def;
+ sc530ai->cur_fps = mode->max_fps;
dev_info(&sc530ai->client->dev, "sensor mode: %d\n",
sc530ai->cur_mode->hdr_mode);
}
@@ -1191,6 +1221,10 @@
SC530AI_REG_VALUE_08BIT,
SC530AI_MODE_SW_STANDBY);
break;
+ case RKMODULE_GET_CHANNEL_INFO:
+ ch_info = (struct rkmodule_channel_info *)arg;
+ ret = sc530ai_get_channel_info(sc530ai, ch_info);
+ break;
default:
ret = -ENOIOCTLCMD;
break;
@@ -1207,6 +1241,7 @@
struct rkmodule_inf *inf;
struct rkmodule_hdr_cfg *hdr;
struct preisp_hdrae_exp_s *hdrae;
+ struct rkmodule_channel_info *ch_info;
long ret = 0;
u32 stream = 0;
@@ -1276,6 +1311,21 @@
return -EFAULT;
ret = sc530ai_ioctl(sd, cmd, &stream);
+ break;
+ case RKMODULE_GET_CHANNEL_INFO:
+ ch_info = kzalloc(sizeof(*ch_info), GFP_KERNEL);
+ if (!ch_info) {
+ ret = -ENOMEM;
+ return ret;
+ }
+
+ ret = sc530ai_ioctl(sd, cmd, ch_info);
+ if (!ret) {
+ ret = copy_to_user(up, ch_info, sizeof(*ch_info));
+ if (ret)
+ ret = -EFAULT;
+ }
+ kfree(ch_info);
break;
default:
ret = -ENOIOCTLCMD;
@@ -1457,7 +1507,7 @@
regulator_bulk_disable(sc530ai_NUM_SUPPLIES, sc530ai->supplies);
}
-static int sc530ai_runtime_resume(struct device *dev)
+static int __maybe_unused sc530ai_runtime_resume(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);
struct v4l2_subdev *sd = i2c_get_clientdata(client);
@@ -1466,7 +1516,7 @@
return __sc530ai_power_on(sc530ai);
}
-static int sc530ai_runtime_suspend(struct device *dev)
+static int __maybe_unused sc530ai_runtime_suspend(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);
struct v4l2_subdev *sd = i2c_get_clientdata(client);
@@ -1483,7 +1533,7 @@
struct sc530ai *sc530ai = to_sc530ai(sd);
struct v4l2_mbus_framefmt *try_fmt =
v4l2_subdev_get_try_format(sd, fh->pad, 0);
- const struct sc530ai_mode *def_mode = &supported_modes[0];
+ const struct sc530ai_mode *def_mode = &sc530ai->support_modes[0];
mutex_lock(&sc530ai->mutex);
/* Initialize try_fmt */
@@ -1529,14 +1579,16 @@
struct v4l2_subdev_pad_config *cfg,
struct v4l2_subdev_frame_interval_enum *fie)
{
- if (fie->index >= ARRAY_SIZE(supported_modes))
+ struct sc530ai *sc530ai = to_sc530ai(sd);
+
+ if (fie->index >= sc530ai->support_modes_num)
return -EINVAL;
- fie->code = supported_modes[fie->index].bus_fmt;
- fie->width = supported_modes[fie->index].width;
- fie->height = supported_modes[fie->index].height;
- fie->interval = supported_modes[fie->index].max_fps;
- fie->reserved[0] = supported_modes[fie->index].hdr_mode;
+ fie->code = sc530ai->support_modes[fie->index].bus_fmt;
+ fie->width = sc530ai->support_modes[fie->index].width;
+ fie->height = sc530ai->support_modes[fie->index].height;
+ fie->interval = sc530ai->support_modes[fie->index].max_fps;
+ fie->reserved[0] = sc530ai->support_modes[fie->index].hdr_mode;
return 0;
}
@@ -1562,7 +1614,6 @@
static const struct v4l2_subdev_video_ops sc530ai_video_ops = {
.s_stream = sc530ai_s_stream,
.g_frame_interval = sc530ai_g_frame_interval,
- .g_mbus_config = sc530ai_g_mbus_config,
};
static const struct v4l2_subdev_pad_ops sc530ai_pad_ops = {
@@ -1572,6 +1623,7 @@
.get_fmt = sc530ai_get_fmt,
.set_fmt = sc530ai_set_fmt,
.get_selection = sc530ai_get_selection,
+ .get_mbus_config = sc530ai_g_mbus_config,
};
static const struct v4l2_subdev_ops sc530ai_subdev_ops = {
@@ -1579,6 +1631,14 @@
.video = &sc530ai_video_ops,
.pad = &sc530ai_pad_ops,
};
+
+static void sc530ai_modify_fps_info(struct sc530ai *sc5330ai)
+{
+ const struct sc530ai_mode *mode = sc5330ai->cur_mode;
+
+ sc5330ai->cur_fps.denominator = mode->max_fps.denominator * mode->vts_def /
+ sc5330ai->cur_vts;
+}
static int sc530ai_set_ctrl(struct v4l2_ctrl *ctrl)
{
@@ -1608,7 +1668,7 @@
switch (ctrl->id) {
case V4L2_CID_EXPOSURE:
if (sc530ai->cur_mode->hdr_mode != NO_HDR)
- return ret;
+ goto ctrl_end;
val = ctrl->val << 1;
ret = sc530ai_write_reg(sc530ai->client,
SC530AI_REG_EXPOSURE_H,
@@ -1627,7 +1687,7 @@
break;
case V4L2_CID_ANALOGUE_GAIN:
if (sc530ai->cur_mode->hdr_mode != NO_HDR)
- return ret;
+ goto ctrl_end;
sc530ai_get_gain_reg(ctrl->val, &again, &dgain, &dgain_fine);
ret = sc530ai_write_reg(sc530ai->client,
@@ -1642,7 +1702,7 @@
SC530AI_REG_ANA_GAIN,
SC530AI_REG_VALUE_08BIT,
again);
-
+ dev_dbg(&client->dev, "set gain 0x%x\n", ctrl->val);
break;
case V4L2_CID_VBLANK:
vts = ctrl->val + sc530ai->cur_mode->height;
@@ -1654,6 +1714,11 @@
SC530AI_REG_VTS_L,
SC530AI_REG_VALUE_08BIT,
vts & 0xff);
+ if (!ret)
+ sc530ai->cur_vts = vts;
+ if (sc530ai->cur_vts != sc530ai->cur_mode->vts_def)
+ sc530ai_modify_fps_info(sc530ai);
+ dev_dbg(&client->dev, "set vblank 0x%x\n", ctrl->val);
break;
case V4L2_CID_HFLIP:
ret = sc530ai_read_reg(sc530ai->client, SC530AI_FLIP_MIRROR_REG,
@@ -1691,6 +1756,7 @@
break;
}
+ctrl_end:
pm_runtime_put(&client->dev);
return ret;
@@ -1715,22 +1781,23 @@
fwnode = of_fwnode_handle(endpoint);
rval = fwnode_property_read_u32_array(fwnode, "data-lanes", NULL, 0);
if (rval <= 0) {
- dev_warn(dev, " Get mipi lane num failed!\n");
- return -1;
+ dev_err(dev, " Get mipi lane num failed!\n");
+ return -EINVAL;
}
sc530ai->lane_num = rval;
+ dev_info(dev, "lane_num = %d\n", sc530ai->lane_num);
if (sc530ai->lane_num == 2) {
- sc530ai->cur_mode = &supported_modes[2];
- dev_info(dev, "lane_num(%d)\n", sc530ai->lane_num);
- } else if (sc530ai->lane_num == 2) {
- sc530ai->cur_mode = &supported_modes[0];
- dev_info(dev, "lane_num(%d)\n", sc530ai->lane_num);
- } else {
- dev_err(dev, "unsupported lane_num(%d)\n", sc530ai->lane_num);
- return -1;
+ sc530ai->support_modes = supported_modes_2lane;
+ sc530ai->support_modes_num = ARRAY_SIZE(supported_modes_2lane);
+ } else if (sc530ai->lane_num == 4) {
+ sc530ai->support_modes = supported_modes_4lane;
+ sc530ai->support_modes_num = ARRAY_SIZE(supported_modes_4lane);
}
+
+ sc530ai->cur_mode = &sc530ai->support_modes[0];
+
return 0;
}
@@ -1809,6 +1876,8 @@
}
sc530ai->subdev.ctrl_handler = handler;
sc530ai->has_init_exp = false;
+ sc530ai->cur_vts = mode->vts_def;
+ sc530ai->cur_fps = mode->max_fps;
return 0;
@@ -1857,7 +1926,7 @@
struct v4l2_subdev *sd;
char facing[2];
int ret;
- u32 i, hdr_mode = 0;
+ u32 hdr_mode = 0;
dev_info(dev, "driver version: %02x.%02x.%02x",
DRIVER_VERSION >> 16,
@@ -1883,14 +1952,10 @@
}
sc530ai->client = client;
- for (i = 0; i < ARRAY_SIZE(supported_modes); i++) {
- if (hdr_mode == supported_modes[i].hdr_mode) {
- sc530ai->cur_mode = &supported_modes[i];
- break;
- }
- }
- if (i == ARRAY_SIZE(supported_modes))
- sc530ai->cur_mode = &supported_modes[0];
+
+ ret = sc530ai_parse_of(sc530ai);
+ if (ret)
+ return -EINVAL;
sc530ai->xvclk = devm_clk_get(dev, "xvclk");
if (IS_ERR(sc530ai->xvclk)) {
@@ -1928,10 +1993,6 @@
dev_err(dev, "Failed to get power regulators\n");
return ret;
}
-
- ret = sc530ai_parse_of(sc530ai);
- if (ret != 0)
- return -EINVAL;
mutex_init(&sc530ai->mutex);
--
Gitblit v1.6.2