From a288728309681e3a6a947308d0c5c3c0b6db3e35 Mon Sep 17 00:00:00 2001 From: zouxiaoh Date: Wed, 19 Apr 2023 14:26:17 +0800 Subject: [PATCH] realsense engineer release #6 (#132) support seperate start and stop different vc add Y8 format use 4bytes data for Y12i fix i2c address map issue for multiple D457 avoid conflict of i2c address for max9296/max9295/d457 Signed-off-by: zouxiaoh --- drivers/media/i2c/ar0234.c | 125 +-------- drivers/media/i2c/d4xx.c | 263 +++++++++++------- drivers/media/i2c/imx390.c | 2 + drivers/media/i2c/lt6911uxc.c | 3 + drivers/media/i2c/ti953-ser.c | 2 + drivers/media/i2c/ti960-des.c | 2 + drivers/media/pci/intel/ipu-bus.c | 4 +- .../media/pci/intel/ipu-isys-csi2-be-soc.c | 1 - drivers/media/pci/intel/ipu-isys-csi2.c | 33 +-- drivers/media/pci/intel/ipu-isys-queue.c | 23 +- drivers/media/pci/intel/ipu-isys-subdev.c | 4 +- drivers/media/pci/intel/ipu-isys-video.c | 33 ++- drivers/media/pci/intel/ipu-isys.c | 63 +++++ drivers/media/pci/intel/ipu-psys.c | 4 +- drivers/media/pci/intel/ipu.c | 6 + .../media/pci/intel/ipu6/ipu6-isys-dwc-phy.c | 126 ++++----- .../media/platform/intel/ipu6-acpi-pdata.c | 6 +- 17 files changed, 362 insertions(+), 338 deletions(-) diff --git a/drivers/media/i2c/ar0234.c b/drivers/media/i2c/ar0234.c index 745d9a20280c..439af8dfcb21 100644 --- a/drivers/media/i2c/ar0234.c +++ b/drivers/media/i2c/ar0234.c @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-2.0 -// Copyright (c) 2022 Intel Corporation. +// Copyright (c) 2023 Intel Corporation. #include #include @@ -16,8 +16,6 @@ #include #include -#include - #define AR0234_REG_VALUE_08BIT 1 #define AR0234_REG_VALUE_16BIT 2 @@ -1358,8 +1356,6 @@ struct ar0234 { struct v4l2_ctrl *hblank; struct v4l2_ctrl *vflip; struct v4l2_ctrl *hflip; - struct v4l2_ctrl *query_sub_stream; - struct v4l2_ctrl *set_sub_stream; /* Current mode */ const struct ar0234_mode *cur_mode; @@ -1498,8 +1494,6 @@ static u64 get_hblank(struct ar0234 *ar0234) return hblank; } -static int ar0234_set_stream(struct v4l2_subdev *sd, int enable); - static int ar0234_set_ctrl(struct v4l2_ctrl *ctrl) { struct ar0234 *ar0234 = container_of(ctrl->handler, @@ -1509,15 +1503,6 @@ static int ar0234_set_ctrl(struct v4l2_ctrl *ctrl) int ret = 0; u32 val; - if (ctrl->id == V4L2_CID_IPU_SET_SUB_STREAM) { - val = (*ctrl->p_new.p_s64 & 0xFFFF); - dev_info(&client->dev, "V4L2_CID_IPU_SET_SUB_STREAM %x\n", val); - mutex_unlock(&ar0234->mutex); - ret = ar0234_set_stream(&ar0234->sd, val & 0x00FF); - mutex_lock(&ar0234->mutex); - return ret; - } - /* Propagate change of current control to all related controls */ if (ctrl->id == V4L2_CID_VBLANK) { /* Update max exposure while meeting expected vblanking */ @@ -1611,11 +1596,7 @@ static int ar0234_set_ctrl(struct v4l2_ctrl *ctrl) val); dev_info(&client->dev, "set hflip %d\n", ctrl->val); break; - case V4L2_CID_IPU_QUERY_SUB_STREAM: - dev_dbg(&client->dev, "query stream\n"); - break; default: - dev_err(&client->dev, "unexpected ctrl id 0x%08x\n", ctrl->id); ret = -EINVAL; break; } @@ -1701,83 +1682,6 @@ static struct v4l2_ctrl_config ar0234_frame_interval = { .flags = V4L2_CTRL_FLAG_READ_ONLY, }; -static struct v4l2_ctrl_config ar0234_q_sub_stream = { - .ops = &ar0234_ctrl_ops, - .id = V4L2_CID_IPU_QUERY_SUB_STREAM, - .name = "query virtual channel", - .type = V4L2_CTRL_TYPE_INTEGER_MENU, - .max = 1, - .min = 0, - .def = 0, - .menu_skip_mask = 0, - .qmenu_int = NULL, -}; - -static const struct v4l2_ctrl_config ar0234_s_sub_stream = { - .ops = &ar0234_ctrl_ops, - .id = V4L2_CID_IPU_SET_SUB_STREAM, - .name = "set virtual channel", - .type = V4L2_CTRL_TYPE_INTEGER64, - .max = 0xFFFF, - .min = 0, - .def = 0, - .step = 1, -}; - -#define MIPI_CSI2_TYPE_RAW8 0x2a -#define MIPI_CSI2_TYPE_RAW10 0x2b - -static unsigned int mbus_code_to_mipi(u32 code) -{ - switch (code) { - case MEDIA_BUS_FMT_SGRBG10_1X10: - return MIPI_CSI2_TYPE_RAW10; - case MEDIA_BUS_FMT_SGRBG8_1X8: - return MIPI_CSI2_TYPE_RAW8; - default: - WARN_ON(1); - return -EINVAL; - } -} - -static void set_sub_stream_fmt(s64 *sub_stream, u32 code) -{ - *sub_stream &= 0xFFFFFFFFFFFF0000; - *sub_stream |= code; -} - -static void set_sub_stream_h(s64 *sub_stream, u32 height) -{ - s64 val = height; - val &= 0xFFFF; - *sub_stream &= 0xFFFFFFFF0000FFFF; - *sub_stream |= val << 16; -} - -static void set_sub_stream_w(s64 *sub_stream, u32 width) -{ - s64 val = width; - val &= 0xFFFF; - *sub_stream &= 0xFFFF0000FFFFFFFF; - *sub_stream |= val << 32; -} - -static void set_sub_stream_dt(s64 *sub_stream, u32 dt) -{ - s64 val = dt; - val &= 0xFF; - *sub_stream &= 0xFF00FFFFFFFFFFFF; - *sub_stream |= val << 48; -} - -static void set_sub_stream_vc_id(s64 *sub_stream, u32 vc_id) -{ - s64 val = vc_id; - val &= 0xFF; - *sub_stream &= 0x00FFFFFFFFFFFFFF; - *sub_stream |= val << 56; -} - static int ar0234_init_controls(struct ar0234 *ar0234) { struct i2c_client *client = v4l2_get_subdevdata(&ar0234->sd); @@ -1859,27 +1763,12 @@ static int ar0234_init_controls(struct ar0234 *ar0234) ar0234->hflip = v4l2_ctrl_new_std(ctrl_hdlr, &ar0234_ctrl_ops, V4L2_CID_HFLIP, 0, 1, 1, 0); - ar0234_q_sub_stream.qmenu_int = &ar0234->sub_stream; - ar0234->query_sub_stream = v4l2_ctrl_new_custom(ctrl_hdlr, &ar0234_q_sub_stream, NULL); - if (ctrl_hdlr->error) { - dev_dbg(&client->dev, "new query sub stream ctrl, error = %d.\n", - ctrl_hdlr->error); - return ctrl_hdlr->error; - } - - ar0234->set_sub_stream = v4l2_ctrl_new_custom(ctrl_hdlr, &ar0234_s_sub_stream, NULL); - if (ctrl_hdlr->error) { - dev_dbg(&client->dev, "new set sub stream ctrl, error = %d.\n", - ctrl_hdlr->error); - return ctrl_hdlr->error; - } - if (ctrl_hdlr->error) return ctrl_hdlr->error; ar0234->sd.ctrl_handler = ctrl_hdlr; - return ret; + return 0; } static void ar0234_update_pad_format(const struct ar0234_mode *mode, @@ -1914,9 +1803,7 @@ static int ar0234_start_streaming(struct ar0234 *ar0234) } } - ar0234->set_sub_stream->flags |= V4L2_CTRL_FLAG_READ_ONLY; ret = __v4l2_ctrl_handler_setup(ar0234->sd.ctrl_handler); - ar0234->set_sub_stream->flags &= ~V4L2_CTRL_FLAG_READ_ONLY; if (ret) return ret; @@ -2095,12 +1982,6 @@ static int ar0234_set_format(struct v4l2_subdev *sd, __v4l2_ctrl_s_ctrl(ar0234->fps, mode->fps); __v4l2_ctrl_s_ctrl(ar0234->frame_interval, 1000 / mode->fps); - - set_sub_stream_fmt(&ar0234->sub_stream, mode->code); - set_sub_stream_h(&ar0234->sub_stream, mode->height); - set_sub_stream_w(&ar0234->sub_stream, mode->width); - set_sub_stream_dt(&ar0234->sub_stream, mbus_code_to_mipi(mode->code)); - set_sub_stream_vc_id(&ar0234->sub_stream, 0); } mutex_unlock(&ar0234->mutex); @@ -2392,6 +2273,7 @@ static int ar0234_probe(struct i2c_client *client) pm_runtime_set_active(&client->dev); pm_runtime_enable(&client->dev); pm_runtime_idle(&client->dev); + dev_err(&client->dev, "%s Probe Succeeded", ar0234->sd.name); return 0; @@ -2401,6 +2283,7 @@ static int ar0234_probe(struct i2c_client *client) probe_error_v4l2_ctrl_handler_free: v4l2_ctrl_handler_free(ar0234->sd.ctrl_handler); mutex_destroy(&ar0234->mutex); + dev_err(&client->dev, "%s Probe Failed", ar0234->sd.name); return ret; } diff --git a/drivers/media/i2c/d4xx.c b/drivers/media/i2c/d4xx.c index 7bb532d5e0e6..8c4f36d913df 100644 --- a/drivers/media/i2c/d4xx.c +++ b/drivers/media/i2c/d4xx.c @@ -140,7 +140,22 @@ //#define DS5_DEBUG_VCHAN_N 1 //#define DS5_MOTION_T_VCHAN_N 2 -#define D4XX_I2C_ADDRESS_1 0x12 +#define MAX9295_REG0 0x0000 +#define MAX9295_I2C_4 0x0044 +#define MAX9295_I2C_5 0x0045 + +#define MAX9296_CTRL0 0x0010 +#define RESET_LINK (0x1 << 6) +#define RESET_ONESHOT (0x1 << 5) +#define AUTO_LINK (0x1 << 4) +#define DUAL_LINK (0x0) +#define LINK_A (0x1) +#define LINK_B (0x2) +#define SPLITTER (0x3) +#define MAX9296_NUM (4) + +#define MAX9295_I2C_ADDR_DEF 0x40 +#define D457_I2C_ADDR 0x10 enum ds5_mux_pad { DS5_MUX_PAD_EXTERNAL, @@ -497,6 +512,9 @@ static int max9296_write_8(struct ds5 *state, u16 reg, u8 val) dev_dbg(&state->client->dev, "%s(): i2c write 0x%04x: 0x%x\n", __func__, reg, val); + dev_dbg(&state->client->dev, "%s(): (%d), 0x%02x 0x%04x = 0x%02x\n", + __func__, ret, state->client->addr, reg, val); + return ret; } @@ -513,6 +531,9 @@ static int max9296_read_8(struct ds5 *state, u16 reg, u8 *val) dev_info(&state->client->dev, "%s(): i2c read 0x%04x = 0x%x\n", __func__, reg, *val); + dev_dbg(&state->client->dev, "%s(): (%d), 0x%02x 0x%04x = 0x%02x\n", + __func__, ret, state->client->addr, reg, *val); + return ret; } static int max9295_write_8(struct ds5 *state, u16 reg, u8 val) @@ -528,6 +549,28 @@ static int max9295_write_8(struct ds5 *state, u16 reg, u8 val) dev_info(&state->client->dev, "%s(): i2c write 0x%04x: 0x%x\n", __func__, reg, val); + dev_dbg(&state->client->dev, "%s(): (%d), 0x%02x 0x%04x = 0x%02x\n", + __func__, ret, state->client->addr, reg, val); + + return ret; +} + +static int max9295_read_8(struct ds5 *state, u16 reg, u8 *val) +{ + int ret; + + ret = regmap_raw_read(state->regmap_max9295, reg, val, 1); + if (ret < 0) + dev_err(&state->client->dev, "%s(): i2c read failed %d, 0x%04x\n", + __func__, ret, reg); + else + if (state->dfu_dev.dfu_state_flag == DS5_DFU_IDLE) + dev_info(&state->client->dev, "%s(): i2c read 0x%04x = 0x%x\n", + __func__, reg, *val); + + dev_dbg(&state->client->dev, "%s(): (%d), 0x%02x 0x%04x = 0x%02x\n", + __func__, ret, state->client->addr, reg, *val); + return ret; } @@ -1811,6 +1854,8 @@ static int ds5_set_calibration_data(struct ds5 *state, return -EINVAL; } +static int ds5_mux_s_stream(struct v4l2_subdev *sd, int on); + static int ds5_s_state(struct ds5 *state, int vc) { int ret = 0; @@ -1851,8 +1896,6 @@ static int ds5_s_state(struct ds5 *state, int vc) return ret; } -static int ds5_mux_s_stream(struct v4l2_subdev *sd, int on); - static int ds5_s_ctrl(struct v4l2_ctrl *ctrl) { struct ds5 *state = container_of(ctrl->handler, struct ds5, @@ -2163,10 +2206,10 @@ static int ds5_s_ctrl(struct v4l2_ctrl *ctrl) dev_info(&state->client->dev, "V4L2_CID_IPU_SET_SUB_STREAM %x\n", val); vc_id = (val >> 8) & 0x00FF; on = val & 0x00FF; - if (on == 0xff) { + if (vc_id < DS5_MUX_PAD_COUNT) ret = ds5_s_state(state, vc_id); + if (on == 0xff) break; - } if (vc_id > NR_OF_DS5_STREAMS - 1) dev_err(&state->client->dev, "invalid vc %d\n", vc_id); else @@ -3293,7 +3336,9 @@ static int ds5_mux_set_fmt(struct v4l2_subdev *sd, // u32 pad = fmt->pad; int ret = 0; int substream = -1; - + if (pad != DS5_MUX_PAD_EXTERNAL) + ds5_s_state(state, pad - 1); + sensor = state->mux.last_set; switch (pad) { case DS5_MUX_PAD_DEPTH_A: case DS5_MUX_PAD_MOTION_T_A: @@ -3350,8 +3395,10 @@ static int ds5_mux_get_fmt(struct v4l2_subdev *sd, int ret = 0; struct ds5_sensor *sensor = state->mux.last_set; u32 pad = sensor->mux_pad; - - dev_info(sd->dev, "%s(): %u %p\n", __func__, pad, state->mux.last_set); + if (pad != DS5_MUX_PAD_EXTERNAL) + ds5_s_state(state, pad - 1); + sensor = state->mux.last_set; + dev_info(sd->dev, "%s(): %u %s %p\n", __func__, pad, ds5_get_sensor_name(state), state->mux.last_set); switch (pad) { case DS5_MUX_PAD_DEPTH_A: @@ -3433,6 +3480,28 @@ static int ds5_mux_s_frame_interval(struct v4l2_subdev *sd, return 0; } +int d4xx_reset_oneshot(struct ds5 *state) +{ + struct d4xx_pdata *dpdata = state->client->dev.platform_data; + struct i2c_board_info *deser = dpdata->deser_board_info; + + int s_addr = state->client->addr; + int n_addr = deser->addr; + int ret = 0; + + if (n_addr) { + state->client->addr = n_addr; + dev_warn(&state->client->dev, "One-shot reset 0x%x enable auto-link\n", n_addr); + /* One-shot reset enable auto-link */ + ret = max9296_write_8(state, MAX9296_CTRL0, RESET_ONESHOT | AUTO_LINK | LINK_A); + state->client->addr = s_addr; + /* delay to settle link */ + msleep(100); + } + + return ret; +} + static int ds5_mux_s_stream(struct v4l2_subdev *sd, int on) { struct ds5 *state = container_of(sd, struct ds5, mux.sd.subdev); @@ -3441,7 +3510,9 @@ static int ds5_mux_s_stream(struct v4l2_subdev *sd, int on) unsigned int i = 0; int restore_val = 0; u16 config_status_base, stream_status_base, stream_id, vc_id; - + // spare duplicate calls + if (state->mux.last_set->streaming == on) + return 0; if (state->is_depth) { config_status_base = DS5_DEPTH_CONFIG_STATUS; stream_status_base = DS5_DEPTH_STREAM_STATUS; @@ -3506,11 +3577,13 @@ static int ds5_mux_s_stream(struct v4l2_subdev *sd, int on) dev_dbg(&state->client->dev, "started after %dms\n", i * DS5_START_POLL_TIME); } - } else { + } else { // off ret = ds5_write(state, DS5_START_STOP_STREAM, DS5_STREAM_STOP | stream_id); if (ret < 0) goto restore_s_state; + + d4xx_reset_oneshot(state); } ds5_read(state, config_status_base, &status); @@ -4606,83 +4679,82 @@ static const struct regmap_config ds5_regmap_max9295 = { .val_format_endian = REGMAP_ENDIAN_NATIVE, }; -#define RESET_LINK (0x1 << 6) -#define RESET_ONESHOT (0x1 << 5) -#define AUTO_LINK (0x1 << 4) -#define DUAL_LINK (0x0) -#define LINK_A (0x1) -#define LINK_B (0x2) -#define SPLITTER (0x3) static int ds5_i2c_addr_setting(struct i2c_client *c, struct ds5 *state) { + int curr_max9296 = c->addr; + int max9296_addrs[MAX9296_NUM] = {0x48, 0x4a, 0x68, 0x6c}; + int i; + u8 val; int ret; + struct d4xx_pdata *dpdata = c->dev.platform_data; + unsigned short ser_alias; + unsigned short sensor_alias; + + /* TODO: 2x D457 subdev connect to MAX9296 */ + if (dpdata->subdev_num >= 1) { + curr_max9296 = c->addr; + sensor_alias = dpdata->subdev_info[0].board_info.addr; + ser_alias = dpdata->subdev_info[0].ser_alias; + } else { + dev_err(&c->dev, "no subdev found!\n"); + return -EINVAL; + } - state->regmap_max9296 = devm_regmap_init_i2c(c, &ds5_regmap_max9296); - if (IS_ERR(state->regmap_max9296)) { - ret = PTR_ERR(state->regmap_max9296); - dev_err(&c->dev, "regmap max9296 init failed: %d\n", ret); - return ret; + dev_dbg(&c->dev, "curr_max9296 0x%02x, sensor_alias 0x%02x, ser_alias 0x%02x\n", + curr_max9296, sensor_alias, ser_alias); + + /* + * don't reset link, + * check max9296 i2c addr + 1, + * max9295 i2c addr reassigned already. + */ + c->addr = curr_max9296 + 1; + ret = max9295_read_8(state, MAX9295_REG0, &val); + if (!ret) { + max9295_write_8(state, MAX9295_REG0, ser_alias << 1); + msleep_range(1000); /* need this? */ + c->addr = ser_alias; + max9295_write_8(state, MAX9295_I2C_4, sensor_alias << 1); + max9295_write_8(state, MAX9295_I2C_5, D457_I2C_ADDR << 1); + c->addr = sensor_alias; + return 0; } - state->regmap_max9295 = devm_regmap_init_i2c(c, &ds5_regmap_max9295); - if (IS_ERR(state->regmap_max9295)) { - ret = PTR_ERR(state->regmap_max9295); - dev_err(&c->dev, "regmap max9295 init failed: %d\n", ret); - return ret; + /* i2c addr reassignment for all max9295 */ + for (i = 0; i < MAX9296_NUM; i++) { + c->addr = max9296_addrs[i]; + max9296_write_8(state, MAX9296_CTRL0, RESET_LINK); + } + + for (i = 0; i < MAX9296_NUM; i++) { + /* release reset */ + c->addr = max9296_addrs[i]; + max9296_write_8(state, MAX9296_CTRL0, AUTO_LINK | LINK_A); + msleep_range(1000); + + if (curr_max9296 == max9296_addrs[i]) { + c->addr = MAX9295_I2C_ADDR_DEF; + ret = max9295_read_8(state, MAX9295_REG0, &val); + if (ret < 0) { + dev_err(&c->dev, "no max9295 found for max9296 %x\n", curr_max9296); + continue; + } + max9295_write_8(state, MAX9295_REG0, ser_alias << 1); + msleep_range(1000); // need this? + c->addr = ser_alias; + max9295_write_8(state, MAX9295_I2C_4, sensor_alias << 1); + max9295_write_8(state, MAX9295_I2C_5, D457_I2C_ADDR << 1); + continue; + } + + c->addr = MAX9295_I2C_ADDR_DEF; + ret = max9295_read_8(state, MAX9295_REG0, &val); + if (ret < 0) + continue; + max9295_write_8(state, MAX9295_REG0, (max9296_addrs[i] + 1) << 1); } - c->addr = 0x48; - max9296_write_8(state, 0x0010, 0x40); - c->addr = 0x4a; - max9296_write_8(state, 0x0010, 0x40); - c->addr = 0x68; - max9296_write_8(state, 0x0010, 0x40); - c->addr = 0x6c; - max9296_write_8(state, 0x0010, 0x40); - - c->addr = 0x6c; - max9296_write_8(state, 0x0010, 0x32); - msleep_range(1000); - - c->addr = 0x40; - max9295_write_8(state, 0x0000, 0xc8); // 0x64 - c->addr = 0x64; - msleep_range(1000); - - max9295_write_8(state, 0x0044, 0x30); // 0x18 - max9295_write_8(state, 0x0045, 0x20); - - c->addr = 0x68; - max9296_write_8(state, 0x0010, 0x32); - msleep_range(1000); - - c->addr = 0x40; - max9295_write_8(state, 0x0000, 0xc4); // 0x62 - c->addr = 0x62; - max9295_write_8(state, 0x0044, 0x2c); // 0x16 - max9295_write_8(state, 0x0045, 0x20); - - c->addr = 0x4a; - max9296_write_8(state, 0x0010, 0x32); - msleep_range(1000); - - c->addr = 0x40; - max9295_write_8(state, 0x0000, 0x88); // 0x44 - c->addr = 0x44; - max9295_write_8(state, 0x0044, 0x28); // 0x14 - max9295_write_8(state, 0x0045, 0x20); - - c->addr = 0x48; - max9296_write_8(state, 0x0010, 0x32); - msleep_range(1000); - - c->addr = 0x40; - max9295_write_8(state, 0x0000, 0x84); // 0x42 - c->addr = 0x42; - max9295_write_8(state, 0x0044, 0x24); // 0x12 - max9295_write_8(state, 0x0045, 0x20); - - c->addr = 0x12; + c->addr = sensor_alias; return 0; } @@ -4727,21 +4799,24 @@ static int ds5_probe(struct i2c_client *c, const struct i2c_device_id *id) goto e_regulator; } - if (c->addr == 0x48) - c->addr = 0x12; - if (c->addr == 0x4a) - c->addr = 0x14; - if (c->addr == 0x68) - c->addr = 0x16; - if (c->addr == 0x6c) - c->addr = 0x18; - - if (c->addr == 0x12) { - ret = ds5_i2c_addr_setting(c, state); - if (ret) { - dev_err(&c->dev, "failed apply i2c addr setting\n"); - return ret; - } + state->regmap_max9296 = devm_regmap_init_i2c(c, &ds5_regmap_max9296); + if (IS_ERR(state->regmap_max9296)) { + ret = PTR_ERR(state->regmap_max9296); + dev_err(&c->dev, "regmap max9296 init failed: %d\n", ret); + return ret; + } + + state->regmap_max9295 = devm_regmap_init_i2c(c, &ds5_regmap_max9295); + if (IS_ERR(state->regmap_max9295)) { + ret = PTR_ERR(state->regmap_max9295); + dev_err(&c->dev, "regmap max9295 init failed: %d\n", ret); + return ret; + } + + ret = ds5_i2c_addr_setting(c, state); + if (ret) { + dev_err(&c->dev, "failed apply i2c addr setting\n"); + return ret; } // Verify communication diff --git a/drivers/media/i2c/imx390.c b/drivers/media/i2c/imx390.c index 5fe696a2e8e8..f9d255593fef 100644 --- a/drivers/media/i2c/imx390.c +++ b/drivers/media/i2c/imx390.c @@ -2045,6 +2045,7 @@ static int imx390_probe(struct i2c_client *client) pm_runtime_set_active(&client->dev); pm_runtime_enable(&client->dev); pm_runtime_idle(&client->dev); + dev_err(&client->dev, "Probe Succeeded"); return 0; @@ -2054,6 +2055,7 @@ static int imx390_probe(struct i2c_client *client) probe_error_v4l2_ctrl_handler_free: v4l2_ctrl_handler_free(imx390->sd.ctrl_handler); mutex_destroy(&imx390->mutex); + dev_err(&client->dev, "Probe Failed"); return ret; } diff --git a/drivers/media/i2c/lt6911uxc.c b/drivers/media/i2c/lt6911uxc.c index b009831ed65a..4a7deb1db80c 100644 --- a/drivers/media/i2c/lt6911uxc.c +++ b/drivers/media/i2c/lt6911uxc.c @@ -1524,6 +1524,8 @@ static int lt6911uxc_probe(struct i2c_client *client) pm_runtime_enable(&client->dev); pm_runtime_idle(&client->dev); dev_info(&client->dev, "End to probe lt6911uxc Bridge Chip.\n"); + dev_info(&client->dev, "%s Probe Succeeded", lt6911uxc->sd.name); + return 0; probe_error_media_entity_cleanup: @@ -1532,6 +1534,7 @@ static int lt6911uxc_probe(struct i2c_client *client) probe_error_v4l2_ctrl_handler_free: v4l2_ctrl_handler_free(lt6911uxc->sd.ctrl_handler); mutex_destroy(<6911uxc->mutex); + dev_err(&client->dev, "%s Probe Failed", lt6911uxc->sd.name); return ret; } diff --git a/drivers/media/i2c/ti953-ser.c b/drivers/media/i2c/ti953-ser.c index 7e0d13e66a5d..8d0399c818bb 100644 --- a/drivers/media/i2c/ti953-ser.c +++ b/drivers/media/i2c/ti953-ser.c @@ -98,6 +98,8 @@ bool ti953_detect(struct v4l2_subdev *sd, unsigned short rx_port, unsigned short if (i == ARRAY_SIZE(ti953_FPD3_RX_ID)) ret = true; + else + dev_err(sd->dev, "TI953 Probe Failed"); return ret; } diff --git a/drivers/media/i2c/ti960-des.c b/drivers/media/i2c/ti960-des.c index cae1427ae8ec..4e52ec1d63ec 100644 --- a/drivers/media/i2c/ti960-des.c +++ b/drivers/media/i2c/ti960-des.c @@ -1582,6 +1582,7 @@ static int ti960_probe(struct i2c_client *client, goto free_gpio; } + dev_err(&client->dev, "%s Probe Succeeded", va->sd.name); return 0; free_gpio: @@ -1595,6 +1596,7 @@ static int ti960_probe(struct i2c_client *client, va->pdata->FPD_gpio); } + dev_err(&client->dev, "%s Probe Failed", va->sd.name); return rval; } diff --git a/drivers/media/pci/intel/ipu-bus.c b/drivers/media/pci/intel/ipu-bus.c index c8b0418c4c98..435e59fc2a5d 100644 --- a/drivers/media/pci/intel/ipu-bus.c +++ b/drivers/media/pci/intel/ipu-bus.c @@ -101,9 +101,9 @@ static int ipu_bus_probe(struct device *dev) rval = -ENODEV; goto out_err; } - rval = pm_runtime_get_sync(&adev->dev); + + rval = pm_runtime_resume_and_get(&adev->dev); if (rval < 0) { - pm_runtime_put(&adev->dev); dev_err(&adev->dev, "Failed to get runtime PM\n"); goto out_err; } diff --git a/drivers/media/pci/intel/ipu-isys-csi2-be-soc.c b/drivers/media/pci/intel/ipu-isys-csi2-be-soc.c index 26fad0682b89..5c5275cb8aa4 100644 --- a/drivers/media/pci/intel/ipu-isys-csi2-be-soc.c +++ b/drivers/media/pci/intel/ipu-isys-csi2-be-soc.c @@ -186,7 +186,6 @@ static struct v4l2_subdev_ops csi2_be_soc_sd_ops = { }; static struct media_entity_operations csi2_be_soc_entity_ops = { - .link_validate = v4l2_subdev_link_validate, }; static void csi2_be_soc_set_ffmt(struct v4l2_subdev *sd, diff --git a/drivers/media/pci/intel/ipu-isys-csi2.c b/drivers/media/pci/intel/ipu-isys-csi2.c index fc00fa25babc..67914fd60f7d 100644 --- a/drivers/media/pci/intel/ipu-isys-csi2.c +++ b/drivers/media/pci/intel/ipu-isys-csi2.c @@ -331,6 +331,9 @@ static int csi2_link_validate(struct media_link *link) struct media_pipeline *media_pipe; struct ipu_isys_csi2 *csi2; struct ipu_isys_pipeline *ip; + struct v4l2_subdev *source_sd; + struct v4l2_subdev *sink_sd; + int rval; if (!link->sink->entity || !link->source->entity) @@ -345,26 +348,17 @@ static int csi2_link_validate(struct media_link *link) csi2->receiver_errors = 0; ip->csi2 = csi2; ipu_isys_video_add_capture_done(ip, csi2_capture_done); + source_sd = media_entity_to_v4l2_subdev(link->source->entity); + sink_sd = media_entity_to_v4l2_subdev(link->sink->entity); + if (!source_sd) + return -ENODEV; - rval = v4l2_subdev_link_validate(link); - if (rval) - return rval; - - if (!v4l2_ctrl_g_ctrl(csi2->store_csi2_header)) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 0, 0) - struct media_pad *remote_pad = - media_entity_remote_pad(&csi2->asd.pad[CSI2_PAD_SOURCE]); -#else - struct media_pad *remote_pad = - media_pad_remote_pad_first(&csi2->asd.pad[CSI2_PAD_SOURCE]); -#endif - - if (remote_pad && - is_media_entity_v4l2_subdev(remote_pad->entity)) { - dev_err(&csi2->isys->adev->dev, - "CSI2 BE requires CSI2 headers.\n"); - return -EINVAL; - } + if (strncmp(source_sd->name, IPU_ISYS_ENTITY_PREFIX, + strlen(IPU_ISYS_ENTITY_PREFIX)) != 0) { + ip->external = link->source; + ip->source = to_ipu_isys_subdev(sink_sd)->source; + dev_dbg(&csi2->isys->adev->dev, "%s: using source %d\n", + sink_sd->entity.name, ip->source); } return 0; @@ -664,6 +658,7 @@ void ipu_isys_csi2_sof_event(struct ipu_isys_csi2 *csi2, unsigned int vc) } ev.u.frame_sync.frame_sequence = atomic_inc_return(&ip->sequence) - 1; + ev.id = vc; spin_unlock_irqrestore(&csi2->isys->lock, flags); v4l2_event_queue(vdev, &ev); diff --git a/drivers/media/pci/intel/ipu-isys-queue.c b/drivers/media/pci/intel/ipu-isys-queue.c index 9b5a043fe8f0..6b0b74cc934f 100644 --- a/drivers/media/pci/intel/ipu-isys-queue.c +++ b/drivers/media/pci/intel/ipu-isys-queue.c @@ -585,7 +585,7 @@ static void buf_queue(struct vb2_buffer *vb) return; if (!pipe_av || !media_pipe || !vb->vb2_queue->start_streaming_called) { - dev_info(&av->isys->adev->dev, + dev_dbg(&av->isys->adev->dev, "no pipe or streaming, adding to incoming\n"); return; } @@ -594,7 +594,7 @@ static void buf_queue(struct vb2_buffer *vb) mutex_lock(&pipe_av->mutex); if (ip->nr_streaming != ip->nr_queues) { - dev_info(&av->isys->adev->dev, + dev_dbg(&av->isys->adev->dev, "not streaming yet, adding to incoming\n"); goto out; } @@ -611,7 +611,7 @@ static void buf_queue(struct vb2_buffer *vb) "error: buffer list get failed\n"); WARN_ON(1); } else { - dev_info(&av->isys->adev->dev, + dev_dbg(&av->isys->adev->dev, "not enough buffers available\n"); } goto out; @@ -620,8 +620,6 @@ static void buf_queue(struct vb2_buffer *vb) msg = ipu_get_fw_msg_buf(ip); if (!msg) { rval = -ENOMEM; - dev_err(&av->isys->adev->dev, - "failed to get fw msg buf\n"); goto out; } buf = to_frame_msg_buf(msg); @@ -632,7 +630,7 @@ static void buf_queue(struct vb2_buffer *vb) ip->nr_output_pins); if (!ip->streaming) { - dev_info(&av->isys->adev->dev, + dev_dbg(&av->isys->adev->dev, "got a buffer to start streaming!\n"); rval = ipu_isys_stream_start(ip, &bl, true); if (rval) @@ -819,14 +817,6 @@ static int __start_streaming(struct vb2_queue *q, unsigned int count) mutex_unlock(&av->isys->stream_mutex); - rval = aq->link_fmt_validate(aq); - if (rval) { - dev_err(&av->isys->adev->dev, - "%s: link format validation failed (%d)\n", - av->vdev.name, rval); - goto out_unprepare_streaming; - } - ip = to_ipu_isys_pipeline(media_entity_pipeline(&av->vdev.entity)); pipe_av = container_of(ip, struct ipu_isys_video, ip); if (pipe_av != av) { @@ -839,7 +829,7 @@ static int __start_streaming(struct vb2_queue *q, unsigned int count) ip->nr_queues); list_add(&aq->node, &ip->queues); if (ip->nr_streaming != ip->nr_queues) { - dev_err(&av->isys->adev->dev, + dev_dbg(&av->isys->adev->dev, "%s: streaming queue not match (%d)(%d)\n", av->vdev.name, ip->nr_streaming, ip->nr_queues); goto out; @@ -853,7 +843,7 @@ static int __start_streaming(struct vb2_queue *q, unsigned int count) "buffer list invalid\n"); goto out_stream_start; } else if (rval < 0) { - dev_err(&av->isys->adev->dev, + dev_dbg(&av->isys->adev->dev, "no request available, postponing streamon\n"); goto out; } @@ -882,7 +872,6 @@ static int __start_streaming(struct vb2_queue *q, unsigned int count) mutex_lock(&av->mutex); } -out_unprepare_streaming: mutex_lock(&av->isys->stream_mutex); if (first) ipu_isys_video_prepare_streaming(av, 0); diff --git a/drivers/media/pci/intel/ipu-isys-subdev.c b/drivers/media/pci/intel/ipu-isys-subdev.c index b3bd1e4e3fe1..c1b09421f803 100644 --- a/drivers/media/pci/intel/ipu-isys-subdev.c +++ b/drivers/media/pci/intel/ipu-isys-subdev.c @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-2.0 -// Copyright (C) 2013 - 2020 Intel Corporation +// Copyright (C) 2013 - 2023 Intel Corporation #include #include @@ -35,6 +35,7 @@ unsigned int ipu_isys_mbus_code_to_bpp(u32 code) case MEDIA_BUS_FMT_SGRBG10_1X10: case MEDIA_BUS_FMT_SRGGB10_1X10: return 10; + case MEDIA_BUS_FMT_Y8_1X8: case MEDIA_BUS_FMT_SBGGR8_1X8: case MEDIA_BUS_FMT_SGBRG8_1X8: case MEDIA_BUS_FMT_SGRBG8_1X8: @@ -74,6 +75,7 @@ unsigned int ipu_isys_mbus_code_to_mipi(u32 code) case MEDIA_BUS_FMT_SGRBG10_1X10: case MEDIA_BUS_FMT_SRGGB10_1X10: return IPU_ISYS_MIPI_CSI2_TYPE_RAW10; + case MEDIA_BUS_FMT_Y8_1X8: case MEDIA_BUS_FMT_SBGGR8_1X8: case MEDIA_BUS_FMT_SGBRG8_1X8: case MEDIA_BUS_FMT_SGRBG8_1X8: diff --git a/drivers/media/pci/intel/ipu-isys-video.c b/drivers/media/pci/intel/ipu-isys-video.c index 7595ce75e939..2f76533f69f9 100644 --- a/drivers/media/pci/intel/ipu-isys-video.c +++ b/drivers/media/pci/intel/ipu-isys-video.c @@ -51,7 +51,7 @@ const struct ipu_isys_pixelformat ipu_isys_pfmts_be_soc[] = { IPU_FW_ISYS_FRAME_FORMAT_NV16}, {V4L2_PIX_FMT_XRGB32, 32, 32, 0, MEDIA_BUS_FMT_RGB565_1X16, IPU_FW_ISYS_FRAME_FORMAT_RGBA888}, - {V4L2_PIX_FMT_Y12I, 24, 24, 0, MEDIA_BUS_FMT_RGB888_1X24, + {V4L2_PIX_FMT_Y12I, 32, 32, 0, MEDIA_BUS_FMT_RGB888_1X24, IPU_FW_ISYS_FRAME_FORMAT_RGBA888}, {V4L2_PIX_FMT_XBGR32, 32, 32, 0, MEDIA_BUS_FMT_RGB888_1X24, IPU_FW_ISYS_FRAME_FORMAT_RGBA888}, @@ -1049,8 +1049,12 @@ static int ipu_isys_query_sensor_info(struct media_pad *source_pad, (pad_id - NR_OF_CSI2_BE_SOC_SINK_PADS)) { ip->vc = ip->asv[qm.index].vc; flag = true; - pr_info("The current entityvc:id:%d\n", ip->vc); + pr_info("The current entity vc:id:%d\n", ip->vc); } + dev_dbg(source_pad->entity->graph_obj.mdev->dev, + "dentity vc:%d, dt:%x, substream:%d\n", + ip->vc, ip->asv[qm.index].dt, + ip->asv[qm.index].substream); } if (flag) @@ -1127,10 +1131,9 @@ static int media_pipeline_walk_by_vc(struct ipu_isys_video *av, #endif if (entity->pipe && entity->pipe == pipe) { - pr_err("Pipe active for %s. Can't start for %s\n", + dev_dbg(entity->graph_obj.mdev->dev, + "Pipe active for %s. when start for %s\n", entity->name, entity_err->name); - ret = -EBUSY; - goto error; } /* * If entity's pipe is not null and it is video device, it has @@ -1344,10 +1347,9 @@ static int media_pipeline_walk_by_vc(struct ipu_isys_video *av, entity->name); if (entity->pads[0].pipe && entity->pads[0].pipe == pipe) { - pr_err("Pipe active for %s. Can't start for %s\n", + dev_dbg(entity->graph_obj.mdev->dev, + "Pipe active for %s. when start for %s\n", entity->name, entity_err->name); - ret = -EBUSY; - goto error; } /* * If entity's pipe is not null and it is video device, it has @@ -1565,8 +1567,7 @@ ipu_isys_prepare_fw_cfg_default(struct ipu_isys_video *av, BITS_PER_BYTE), av->isys->line_align); - if (input_pin_info->dt == IPU_ISYS_MIPI_CSI2_TYPE_EMBEDDED8 || - input_pin_info->dt == IPU_ISYS_MIPI_CSI2_TYPE_RGB888) + if (input_pin_info->dt == IPU_ISYS_MIPI_CSI2_TYPE_EMBEDDED8) pin_info->pt = IPU_FW_ISYS_PIN_TYPE_MIPI; else pin_info->pt = aq->css_pin_type; @@ -2033,8 +2034,10 @@ int ipu_isys_video_prepare_streaming(struct ipu_isys_video *av, short_packet_queue_destroy(ip); #if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0) media_pipeline_stop(&av->vdev.entity); + av->vdev.entity.pipe = NULL; #else media_pipeline_stop_for_vc(av); + av->vdev.entity.pads[0].pipe = NULL; #endif media_entity_enum_cleanup(&ip->entity_enum); return 0; @@ -2061,14 +2064,12 @@ int ipu_isys_video_prepare_streaming(struct ipu_isys_video *av, ip->interlaced = false; rval = media_entity_enum_init(&ip->entity_enum, mdev); - if (rval) { - dev_err(dev, "entity enum init failed\n"); + if (rval) return rval; - } rval = media_pipeline_start_by_vc(av, &ip->pipe); if (rval < 0) { - dev_err(dev, "pipeline start failed\n"); + dev_dbg(dev, "pipeline start failed\n"); goto out_enum_cleanup; } @@ -2079,10 +2080,8 @@ int ipu_isys_video_prepare_streaming(struct ipu_isys_video *av, } rval = media_graph_walk_init(&graph, mdev); - if (rval) { - dev_err(dev, "graph walk init failed\n"); + if (rval) goto out_pipeline_stop; - } /* Gather all entities in the graph. */ mutex_lock(&mdev->graph_mutex); diff --git a/drivers/media/pci/intel/ipu-isys.c b/drivers/media/pci/intel/ipu-isys.c index dbf73ac81ba5..5e23af2969e9 100644 --- a/drivers/media/pci/intel/ipu-isys.c +++ b/drivers/media/pci/intel/ipu-isys.c @@ -422,6 +422,52 @@ static int isys_register_ext_subdev(struct ipu_isys *isys, return rval; } +static int isys_unregister_ext_subdev(struct ipu_isys *isys, + struct ipu_isys_subdev_info *sd_info) +{ + struct i2c_adapter *adapter; + struct i2c_client *client; + int bus; + + bus = ipu_get_i2c_bus_id(sd_info->i2c.i2c_adapter_id, + sd_info->i2c.i2c_adapter_bdf, + sizeof(sd_info->i2c.i2c_adapter_bdf)); + if (bus < 0) { + dev_err(&isys->adev->dev, + "getting i2c bus id for adapter %d (bdf %s) failed\n", + sd_info->i2c.i2c_adapter_id, + sd_info->i2c.i2c_adapter_bdf); + return -ENOENT; + } + dev_dbg(&isys->adev->dev, + "got i2c bus id %d for adapter %d (bdf %s)\n", bus, + sd_info->i2c.i2c_adapter_id, + sd_info->i2c.i2c_adapter_bdf); + adapter = i2c_get_adapter(bus); + if (!adapter) { + dev_warn(&isys->adev->dev, "can't find adapter\n"); + return -ENOENT; + } + + dev_dbg(&isys->adev->dev, + "unregister i2c subdev for %s (address %2.2x, bus %d)\n", + sd_info->i2c.board_info.type, sd_info->i2c.board_info.addr, + bus); + + client = isys_find_i2c_subdev(adapter, sd_info); + if (!client) { + dev_dbg(&isys->adev->dev, "Device not exists\n"); + goto skip_put_adapter; + } + + i2c_unregister_device(client); + +skip_put_adapter: + i2c_put_adapter(adapter); + + return 0; +} + static void isys_register_ext_subdevs(struct ipu_isys *isys) { struct ipu_isys_subdev_pdata *spdata = isys->pdata->spdata; @@ -434,6 +480,18 @@ static void isys_register_ext_subdevs(struct ipu_isys *isys) for (sd_info = spdata->subdevs; *sd_info; sd_info++) isys_register_ext_subdev(isys, *sd_info); } + +static void isys_unregister_ext_subdevs(struct ipu_isys *isys) +{ + struct ipu_isys_subdev_pdata *spdata = isys->pdata->spdata; + struct ipu_isys_subdev_info **sd_info; + + if (!spdata) + return; + + for (sd_info = spdata->subdevs; *sd_info; sd_info++) + isys_unregister_ext_subdev(isys, *sd_info); +} #endif static void isys_unregister_subdevices(struct ipu_isys *isys) @@ -769,6 +827,8 @@ static int isys_register_devices(struct ipu_isys *isys) out_isys_notifier_cleanup: #if !IS_ENABLED(CONFIG_VIDEO_INTEL_IPU_USE_PLATFORMDATA) isys_notifier_cleanup(isys); +#else + isys_unregister_ext_subdevs(isys); #endif #if !IS_ENABLED(CONFIG_VIDEO_INTEL_IPU_USE_PLATFORMDATA) @@ -793,6 +853,9 @@ static int isys_register_devices(struct ipu_isys *isys) static void isys_unregister_devices(struct ipu_isys *isys) { isys_unregister_subdevices(isys); +#if IS_ENABLED(CONFIG_VIDEO_INTEL_IPU_USE_PLATFORMDATA) + isys_unregister_ext_subdevs(isys); +#endif v4l2_device_unregister(&isys->v4l2_dev); media_device_unregister(&isys->media_dev); #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0) diff --git a/drivers/media/pci/intel/ipu-psys.c b/drivers/media/pci/intel/ipu-psys.c index ca2830e5dc7e..2e40849dfb72 100644 --- a/drivers/media/pci/intel/ipu-psys.c +++ b/drivers/media/pci/intel/ipu-psys.c @@ -640,17 +640,17 @@ static inline void ipu_psys_kbuf_unmap(struct ipu_psys_kbuffer *kbuf) if (kbuf->kaddr) dma_buf_vunmap(kbuf->dbuf, kbuf->kaddr); #endif - if (kbuf->sgt) { #if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 2, 0) + if (kbuf->sgt) dma_buf_unmap_attachment_unlocked(kbuf->db_attach, kbuf->sgt, DMA_BIDIRECTIONAL); #else + if (kbuf->sgt) dma_buf_unmap_attachment(kbuf->db_attach, kbuf->sgt, DMA_BIDIRECTIONAL); #endif - } if (kbuf->db_attach) dma_buf_detach(kbuf->dbuf, kbuf->db_attach); dma_buf_put(kbuf->dbuf); diff --git a/drivers/media/pci/intel/ipu.c b/drivers/media/pci/intel/ipu.c index 3521154cd8b0..8a812a90c940 100644 --- a/drivers/media/pci/intel/ipu.c +++ b/drivers/media/pci/intel/ipu.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -356,6 +357,11 @@ static int ipu_pci_config_setup(struct pci_dev *dev) pci_command |= PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER; pci_write_config_word(dev, PCI_COMMAND, pci_command); + /* disable IPU6 PCI ATS on mtl ES2 */ + if (ipu_ver == IPU_VER_6EP_MTL && boot_cpu_data.x86_stepping == 0x2 && + pci_ats_supported(dev)) + pci_disable_ats(dev); + /* no msi pci capability for IPU6EP */ if (ipu_ver == IPU_VER_6EP || ipu_ver == IPU_VER_6EP_MTL) { /* likely do nothing as msi not enabled by default */ diff --git a/drivers/media/pci/intel/ipu6/ipu6-isys-dwc-phy.c b/drivers/media/pci/intel/ipu6/ipu6-isys-dwc-phy.c index 29f6f5040790..b63ad7628a69 100644 --- a/drivers/media/pci/intel/ipu6/ipu6-isys-dwc-phy.c +++ b/drivers/media/pci/intel/ipu6/ipu6-isys-dwc-phy.c @@ -262,69 +262,69 @@ struct dwc_dphy_freq_range { #define DPHY_FREQ_RANGE_NUM (63) #define DPHY_FREQ_RANGE_INVALID_INDEX (0xff) const struct dwc_dphy_freq_range freqranges[DPHY_FREQ_RANGE_NUM] = { - {0x00, 80, 97, 80, 448}, - {0x10, 80, 107, 90, 448}, - {0x20, 84, 118, 100, 448}, - {0x30, 93, 128, 110, 448}, - {0x01, 103, 139, 120, 448}, - {0x11, 112, 149, 130, 448}, - {0x21, 122, 160, 140, 448}, - {0x31, 131, 170, 150, 448}, - {0x02, 141, 181, 160, 448}, - {0x12, 150, 191, 170, 448}, - {0x22, 160, 202, 180, 448}, - {0x32, 169, 212, 190, 448}, - {0x03, 183, 228, 205, 448}, - {0x13, 198, 244, 220, 448}, - {0x23, 212, 259, 235, 448}, - {0x33, 226, 275, 250, 448}, - {0x04, 250, 301, 275, 448}, - {0x14, 274, 328, 300, 448}, - {0x25, 297, 354, 325, 448}, - {0x35, 321, 380, 350, 448}, - {0x05, 369, 433, 400, 448}, - {0x16, 416, 485, 450, 448}, - {0x26, 464, 538, 500, 448}, - {0x37, 511, 590, 550, 448}, - {0x07, 559, 643, 600, 448}, - {0x18, 606, 695, 650, 448}, - {0x28, 654, 748, 700, 448}, - {0x39, 701, 800, 750, 448}, - {0x09, 749, 853, 800, 448}, - {0x19, 796, 905, 850, 448}, - {0x29, 844, 958, 900, 448}, - {0x3a, 891, 1010, 950, 448}, - {0x0a, 939, 1063, 1000, 448}, - {0x1a, 986, 1115, 1050, 448}, - {0x2a, 1034, 1168, 1100, 448}, - {0x3b, 1081, 1220, 1150, 448}, - {0x0b, 1129, 1273, 1200, 448}, - {0x1b, 1176, 1325, 1250, 448}, - {0x2b, 1224, 1378, 1300, 448}, - {0x3c, 1271, 1430, 1350, 448}, - {0x0c, 1319, 1483, 1400, 448}, - {0x1c, 1366, 1535, 1450, 448}, - {0x2c, 1414, 1588, 1500, 448}, - {0x3d, 1461, 1640, 1550, 278}, - {0x0d, 1509, 1693, 1600, 287}, - {0x1d, 1556, 1745, 1650, 296}, - {0x2e, 1604, 1798, 1700, 305}, - {0x3e, 1651, 1850, 1750, 314}, - {0x0e, 1699, 1903, 1800, 323}, - {0x1e, 1746, 1955, 1850, 331}, - {0x2f, 1794, 2008, 1900, 340}, - {0x3f, 1841, 2060, 1950, 349}, - {0x0f, 1889, 2113, 2000, 358}, - {0x40, 1936, 2165, 2050, 367}, - {0x41, 1984, 2218, 2100, 376}, - {0x42, 2031, 2270, 2150, 385}, - {0x43, 2079, 2323, 2200, 394}, - {0x44, 2126, 2375, 2250, 403}, - {0x45, 2174, 2428, 2300, 412}, - {0x46, 2221, 2480, 2350, 421}, - {0x47, 2269, 2500, 2400, 430}, - {0x48, 2316, 2500, 2450, 439}, - {0x49, 2364, 2500, 2500, 448}, + {0x00, 80, 97, 80, 335}, + {0x10, 80, 107, 90, 335}, + {0x20, 84, 118, 100, 335}, + {0x30, 93, 128, 110, 335}, + {0x01, 103, 139, 120, 335}, + {0x11, 112, 149, 130, 335}, + {0x21, 122, 160, 140, 335}, + {0x31, 131, 170, 150, 335}, + {0x02, 141, 181, 160, 335}, + {0x12, 150, 191, 170, 335}, + {0x22, 160, 202, 180, 335}, + {0x32, 169, 212, 190, 335}, + {0x03, 183, 228, 205, 335}, + {0x13, 198, 244, 220, 335}, + {0x23, 212, 259, 235, 335}, + {0x33, 226, 275, 250, 335}, + {0x04, 250, 301, 275, 335}, + {0x14, 274, 328, 300, 335}, + {0x25, 297, 354, 325, 335}, + {0x35, 321, 380, 350, 335}, + {0x05, 369, 433, 400, 335}, + {0x16, 416, 485, 450, 335}, + {0x26, 464, 538, 500, 335}, + {0x37, 511, 590, 550, 335}, + {0x07, 559, 643, 600, 335}, + {0x18, 606, 695, 650, 335}, + {0x28, 654, 748, 700, 335}, + {0x39, 701, 800, 750, 335}, + {0x09, 749, 853, 800, 335}, + {0x19, 796, 905, 850, 335}, + {0x29, 844, 958, 900, 335}, + {0x3a, 891, 1010, 950, 335}, + {0x0a, 939, 1063, 1000, 335}, + {0x1a, 986, 1115, 1050, 335}, + {0x2a, 1034, 1168, 1100, 335}, + {0x3b, 1081, 1220, 1150, 335}, + {0x0b, 1129, 1273, 1200, 335}, + {0x1b, 1176, 1325, 1250, 335}, + {0x2b, 1224, 1378, 1300, 335}, + {0x3c, 1271, 1430, 1350, 335}, + {0x0c, 1319, 1483, 1400, 335}, + {0x1c, 1366, 1535, 1450, 335}, + {0x2c, 1414, 1588, 1500, 335}, + {0x3d, 1461, 1640, 1550, 208}, + {0x0d, 1509, 1693, 1600, 214}, + {0x1d, 1556, 1745, 1650, 221}, + {0x2e, 1604, 1798, 1700, 228}, + {0x3e, 1651, 1850, 1750, 234}, + {0x0e, 1699, 1903, 1800, 241}, + {0x1e, 1746, 1955, 1850, 248}, + {0x2f, 1794, 2008, 1900, 255}, + {0x3f, 1841, 2060, 1950, 261}, + {0x0f, 1889, 2113, 2000, 268}, + {0x40, 1936, 2165, 2050, 275}, + {0x41, 1984, 2218, 2100, 281}, + {0x42, 2031, 2270, 2150, 288}, + {0x43, 2079, 2323, 2200, 294}, + {0x44, 2126, 2375, 2250, 302}, + {0x45, 2174, 2428, 2300, 308}, + {0x46, 2221, 2480, 2350, 315}, + {0x47, 2269, 2500, 2400, 321}, + {0x48, 2316, 2500, 2450, 328}, + {0x49, 2364, 2500, 2500, 335}, }; static u32 get_hsfreq_by_mbps(u32 mbps) diff --git a/drivers/media/platform/intel/ipu6-acpi-pdata.c b/drivers/media/platform/intel/ipu6-acpi-pdata.c index 192ce9181232..7cdc6f99ab66 100644 --- a/drivers/media/platform/intel/ipu6-acpi-pdata.c +++ b/drivers/media/platform/intel/ipu6-acpi-pdata.c @@ -610,7 +610,11 @@ int set_serdes_subdev(struct ipu_isys_subdev_info **serdes_sd, /* serdes_subdev_info */ serdes_sdinfo[i].rx_port = i; - serdes_sdinfo[i].ser_alias = serdes_info.ser_map_addr + serdes_info.sensor_num + i; + if (!strcmp(sensor_name, D457_NAME)) + serdes_sdinfo[i].ser_alias = serdes_info.ser_map_addr; + else + serdes_sdinfo[i].ser_alias = serdes_info.ser_map_addr + + serdes_info.sensor_num + i; serdes_sdinfo[i].phy_i2c_addr = serdes_info.phy_i2c_addr; serdes_sdinfo[i].suffix = SUFFIX_BASE + serdes_info.sensor_num + i + 1; }