diff --git a/drivers/media/i2c/ar0234.c b/drivers/media/i2c/ar0234.c index 37dfcb17b63f..0d0e3a4b36ce 100644 --- a/drivers/media/i2c/ar0234.c +++ b/drivers/media/i2c/ar0234.c @@ -1,7 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2019-2024 Intel Corporation. -#include #include #include #include @@ -9,6 +8,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/media/i2c/imx390.c b/drivers/media/i2c/imx390.c index bb68227b93ad..7bb4c5a19a7c 100644 --- a/drivers/media/i2c/imx390.c +++ b/drivers/media/i2c/imx390.c @@ -1,7 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2021-2024 Intel Corporation. -#include #include #include #include @@ -9,10 +8,11 @@ #include #include #include +#include +#include #include #include #include -#include #include #define IMX390_LINK_FREQ_360MHZ 360000000ULL @@ -26,7 +26,6 @@ #define IMX390_REG_VALUE_16BIT 2 #define IMX390_REG_CHIP_ID 0x0330 -#define IMX390_CHIP_ID 0x0 /* vertical-timings from sensor */ #define IMX390_REG_VTS 0x300A @@ -1366,6 +1365,10 @@ static int imx390_set_ctrl(struct v4l2_ctrl *ctrl) struct i2c_client *client = v4l2_get_subdevdata(&imx390->sd); int ret = 0; + /* V4L2 controls values will be applied only when power is already up */ + if (!pm_runtime_get_if_in_use(&client->dev)) + return 0; + switch (ctrl->id) { case IMX390_CID_EXPOSURE_SHS1: case IMX390_CID_EXPOSURE_SHS2: @@ -1895,21 +1898,21 @@ static int imx390_identify_module(struct imx390 *imx390) { struct i2c_client *client = v4l2_get_subdevdata(&imx390->sd); int ret; + int retry = 50; u32 val; - ret = imx390_read_reg(imx390, IMX390_REG_CHIP_ID, - IMX390_REG_VALUE_08BIT, &val); + while (retry--) { + ret = imx390_read_reg(imx390, IMX390_REG_CHIP_ID, + IMX390_REG_VALUE_16BIT, &val); + if (ret == 0) + break; + usleep_range(10000, 10500); + } + if (ret) return ret; - return 0; - - /* chip id not known yet */ - if (val != IMX390_CHIP_ID) { - dev_err(&client->dev, "chip id mismatch: %x!=%x", - IMX390_CHIP_ID, val); - return -ENXIO; - } + dev_info(&client->dev, "chip id: %04x", val); return 0; } diff --git a/drivers/media/i2c/isx031.c b/drivers/media/i2c/isx031.c index d6359d2c6aa6..a84d33e1c1ef 100644 --- a/drivers/media/i2c/isx031.c +++ b/drivers/media/i2c/isx031.c @@ -1,7 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2022 Intel Corporation. -#include #include #include #include @@ -9,6 +8,8 @@ #include #include #include +#include +#include #include #include #include diff --git a/drivers/media/i2c/lt6911uxc.c b/drivers/media/i2c/lt6911uxc.c index c08174f4d2cf..71599a97412d 100644 --- a/drivers/media/i2c/lt6911uxc.c +++ b/drivers/media/i2c/lt6911uxc.c @@ -1,7 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2022-2023 Intel Corporation. -#include #include #include #include @@ -12,6 +11,8 @@ #include #include #include +#include +#include #include #include @@ -21,7 +22,6 @@ #include #include -#include #include /* v4l2 debug level */ diff --git a/drivers/media/i2c/lt6911uxe.c b/drivers/media/i2c/lt6911uxe.c index 0102a652ff4f..d218075b7232 100644 --- a/drivers/media/i2c/lt6911uxe.c +++ b/drivers/media/i2c/lt6911uxe.c @@ -1,7 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2023 Intel Corporation. -#include #include #include #include @@ -12,6 +11,8 @@ #include #include #include +#include +#include #include #include @@ -21,7 +22,6 @@ #include #include -#include #include /* v4l2 debug level */ diff --git a/drivers/media/i2c/ti953-ser.c b/drivers/media/i2c/ti953-ser.c index b9686b900382..c26d7099e15f 100644 --- a/drivers/media/i2c/ti953-ser.c +++ b/drivers/media/i2c/ti953-ser.c @@ -19,18 +19,11 @@ #include "ti960-reg.h" #include "ti953.h" -int ti953_reg_write(struct v4l2_subdev *sd, unsigned short rx_port, - unsigned short ser_alias, unsigned char reg, unsigned char val) +int ti953_reg_write(struct i2c_client *client, unsigned char reg, unsigned char val) { int ret; int retry, timeout = 10; - struct i2c_client *client = v4l2_get_subdevdata(sd); - unsigned short addr_backup; - - dev_dbg(sd->dev, "%s port %d, ser_alias %x, reg %x, val %x", - __func__, rx_port, ser_alias, reg, val); - addr_backup = client->addr; - client->addr = ser_alias; + dev_dbg(&client->dev, "reg %x, val %x", reg, val); for (retry = 0; retry < timeout; retry++) { ret = i2c_smbus_write_byte_data(client, reg, val); if (ret < 0) @@ -39,26 +32,19 @@ int ti953_reg_write(struct v4l2_subdev *sd, unsigned short rx_port, break; } - client->addr = addr_backup; if (retry >= timeout) { - dev_err(sd->dev, - "%s:write reg failed: port=%2x, addr=%2x, reg=%2x\n", - __func__, rx_port, ser_alias, reg); + dev_err(&client->dev, "%s:failed: reg=%2x\n", __func__, reg); return -EREMOTEIO; } return 0; } -int ti953_reg_read(struct v4l2_subdev *sd, unsigned short rx_port, - unsigned short ser_alias, unsigned char reg, unsigned char *val) +int ti953_reg_read(struct i2c_client *client, unsigned char reg, unsigned char *val) { int ret, retry, timeout = 10; - struct i2c_client *client = v4l2_get_subdevdata(sd); unsigned short addr_backup; - addr_backup = client->addr; - client->addr = ser_alias; for (retry = 0; retry < timeout; retry++) { ret = i2c_smbus_read_byte_data(client, reg); if (ret < 0) @@ -69,18 +55,15 @@ int ti953_reg_read(struct v4l2_subdev *sd, unsigned short rx_port, } } - client->addr = addr_backup; if (retry >= timeout) { - dev_err(sd->dev, - "%s:read reg failed: port=%2x, addr=%2x, reg=%2x\n", - __func__, rx_port, ser_alias, reg); + dev_err(&client->dev, "%s:failed: reg=%2x\n", __func__, reg); return -EREMOTEIO; } return 0; } -bool ti953_detect(struct v4l2_subdev *sd, unsigned short rx_port, unsigned short ser_alias) +bool ti953_detect(struct i2c_client *client) { bool ret = false; int i; @@ -88,10 +71,9 @@ bool ti953_detect(struct v4l2_subdev *sd, unsigned short rx_port, unsigned short unsigned char val; for (i = 0; i < ARRAY_SIZE(ti953_FPD3_RX_ID); i++) { - rval = ti953_reg_read(sd, rx_port, ser_alias, - ti953_FPD3_RX_ID[i].reg, &val); + rval = ti953_reg_read(client, ti953_FPD3_RX_ID[i].reg, &val); if (rval) { - dev_err(sd->dev, "port %d, ti953 write timeout %d\n", rx_port, rval); + dev_err(&client->dev, "ti953 read timeout %d\n", rval); break; } if (val != ti953_FPD3_RX_ID[i].val_expected) @@ -101,40 +83,38 @@ 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"); + dev_err(&client->dev, "TI953 Probe Failed"); return ret; } -int ti953_init(struct v4l2_subdev *sd, unsigned short rx_port, unsigned short ser_alias) +int ti953_init(struct i2c_client *client) { int i, rval; for (i = 0; i < ARRAY_SIZE(ti953_init_settings); i++) { - rval = ti953_reg_write(sd, rx_port, ser_alias, - ti953_init_settings[i].reg, - ti953_init_settings[i].val); + rval = ti953_reg_write(client, ti953_init_settings[i].reg, + ti953_init_settings[i].val); if (rval) { - dev_err(sd->dev, "port %d, ti953 write timeout %d\n", 0, rval); + dev_err(&client->dev, "ti953 write timeout %d\n", rval); break; } } - ti953_init_clk(sd, rx_port, ser_alias); + ti953_init_clk(client); return 0; } -int ti953_init_clk(struct v4l2_subdev *sd, unsigned short rx_port, unsigned short ser_alias) +int ti953_init_clk(struct i2c_client *client) { int i, rval; for (i = 0; i < ARRAY_SIZE(ti953_init_settings_clk); i++) { - rval = ti953_reg_write(sd, rx_port, ser_alias, - ti953_init_settings_clk[i].reg, - ti953_init_settings_clk[i].val); + rval = ti953_reg_write(client, ti953_init_settings_clk[i].reg, + ti953_init_settings_clk[i].val); if (rval) { - dev_err(sd->dev, "port %d, ti953 write timeout %d\n", 0, rval); + dev_err(&client->dev, "ti953 write timeout %d\n", rval); break; } } @@ -142,7 +122,7 @@ int ti953_init_clk(struct v4l2_subdev *sd, unsigned short rx_port, unsigned shor return 0; } -int32_t ti953_bus_speed(struct v4l2_subdev *sd, uint16_t rx_port, uint16_t ser_alias, uint8_t i2c_speed) +int32_t ti953_bus_speed(struct i2c_client *client, uint8_t i2c_speed) { struct ti953_register_write scl_high_reg; struct ti953_register_write scl_low_reg; @@ -165,8 +145,7 @@ int32_t ti953_bus_speed(struct v4l2_subdev *sd, uint16_t rx_port, uint16_t ser_a break; case TI953_I2C_SPEED_HIGH: default: - dev_err(sd->dev, "port %u, ti953 unsupported I2C speed mode %u", - rx_port, i2c_speed); + dev_err(&client->dev, "ti953 unsupported I2C speed mode %u", i2c_speed); scl_high_reg.val = TI953_I2C_SCL_HIGH_TIME_STANDARD; scl_low_reg.val = TI953_I2C_SCL_LOW_TIME_STANDARD; ret = -EINVAL; @@ -174,18 +153,15 @@ int32_t ti953_bus_speed(struct v4l2_subdev *sd, uint16_t rx_port, uint16_t ser_a } if (ret != 0) return ret; - ret = ti953_reg_write(sd, rx_port, ser_alias, - scl_high_reg.reg, scl_high_reg.val); + ret = ti953_reg_write(client, scl_high_reg.reg, scl_high_reg.val); if (ret != 0) { - dev_err(sd->dev, "port %u, ti953 write SCL_HIGH_TIME failed %d", - rx_port, ret); + dev_err(&client->dev, "ti953 write SCL_HIGH_TIME failed %d", ret); return ret; } - ret = ti953_reg_write(sd, rx_port, ser_alias, + ret = ti953_reg_write(client, scl_low_reg.reg, scl_low_reg.val); if (ret != 0) { - dev_err(sd->dev, "port %u, ti953 write SCL_LOW_TIME failed %d", - rx_port, ret); + dev_err(&client->dev, " ti953 write SCL_LOW_TIME failed %d", ret); return ret; } diff --git a/drivers/media/i2c/ti953.h b/drivers/media/i2c/ti953.h index da47bfaf23b3..f06f899251ab 100644 --- a/drivers/media/i2c/ti953.h +++ b/drivers/media/i2c/ti953.h @@ -145,16 +145,12 @@ static const struct ti953_register_devid ti953_FPD3_RX_ID[] = { {0xf5, 0x33}, }; -int ti953_reg_write(struct v4l2_subdev *sd, unsigned short rx_port, - unsigned short ser_alias, unsigned char reg, unsigned char val); +int ti953_reg_write(struct i2c_client *client, unsigned char reg, unsigned char val); +int ti953_reg_read(struct i2c_client *client, unsigned char reg, unsigned char *val); -int ti953_reg_read(struct v4l2_subdev *sd, unsigned short rx_port, - unsigned short ser_alias, unsigned char reg, unsigned char *val); - -bool ti953_detect(struct v4l2_subdev *sd, unsigned short rx_port, unsigned short ser_alias); - -int ti953_init(struct v4l2_subdev *sd, unsigned short rx_port, unsigned short ser_alias); -int ti953_init_clk(struct v4l2_subdev *sd, unsigned short rx_port, unsigned short ser_alias); -int32_t ti953_bus_speed(struct v4l2_subdev *sd, uint16_t rx_port, uint16_t ser_alias, uint8_t i2c_speed); +bool ti953_detect(struct i2c_client *client); +int ti953_init(struct i2c_client *client); +int ti953_init_clk(struct i2c_client *client); +int32_t ti953_bus_speed(struct i2c_client *client, uint8_t i2c_speed); #endif diff --git a/drivers/media/i2c/ti960-des.c b/drivers/media/i2c/ti960-des.c index 384447033323..380d000822c6 100644 --- a/drivers/media/i2c/ti960-des.c +++ b/drivers/media/i2c/ti960-des.c @@ -22,9 +22,22 @@ #include "ti960-reg.h" #include "ti953.h" +// FIXME: Move these to platform data +#define D3_BUS_SWITCH_ADDR 0x70 +#define D3_GPIO_EXP_ADDR 0x70 +#define D3_GPIO_EXP_ALIAS(rx_port) (0x60+rx_port) + +#define NUM_ALIASES 8 + #define MIPI_CSI2_TYPE_RAW12 0x2c #define MIPI_CSI2_TYPE_YUV422_8 0x1e +struct ti960_slave { + unsigned short addr; + unsigned short alias; + bool auto_ack; +}; + struct ti960_subdev { struct v4l2_subdev *sd; unsigned short rx_port; @@ -32,6 +45,9 @@ struct ti960_subdev { unsigned short phy_i2c_addr; unsigned short alias_i2c_addr; unsigned short ser_i2c_addr; + struct i2c_client *serializer; + struct i2c_client *gpio_exp; + struct ti960_slave slaves[NUM_ALIASES]; char sd_name[16]; }; @@ -42,6 +58,7 @@ struct ti960 { struct ti960_pdata *pdata; struct ti960_subdev sub_devs[NR_OF_TI960_SINK_PADS]; struct ti960_subdev_pdata subdev_pdata[NR_OF_TI960_SINK_PADS]; + struct i2c_client *bus_switch; const char *name; struct mutex mutex; @@ -179,12 +196,13 @@ static int bus_switch(struct ti960 *va) { int ret; int retry, timeout = 10; - struct i2c_client *client = v4l2_get_subdevdata(&va->sd); - unsigned short addr_backup; + struct i2c_client *client = va->bus_switch; + + if (!va->bus_switch) + return 0; dev_dbg(&client->dev, "try to set bus switch\n"); - addr_backup = client->addr; - client->addr = 0x70; + for (retry = 0; retry < timeout; retry++) { ret = i2c_smbus_write_byte(client, 0x01); if (ret < 0) @@ -193,7 +211,6 @@ static int bus_switch(struct ti960 *va) break; } - client->addr = addr_backup; if (retry >= timeout) { dev_err(&client->dev, "bus switch failed, maybe no bus switch\n"); } @@ -267,30 +284,77 @@ static int ti960_reg_set_bit(struct ti960 *va, unsigned char reg, return ti960_reg_write(va, reg, reg_val); } -static int ti960_map_phy_i2c_addr(struct ti960 *va, unsigned short rx_port, - unsigned short addr) +static int ti960_map_i2c_slave(struct ti960 *va, struct ti960_subdev *sd, + unsigned short addr, unsigned int alias_addr) { int rval; + int index; + struct ti960_slave *slaves = sd->slaves; + + for (index = 0; index < NUM_ALIASES; index++) + if (slaves[index].addr == 0) + break; + + if (index >= NUM_ALIASES) + return -ENOMEM; + if (addr != 0) + slaves[index].addr = addr; + + if (alias_addr != 0) + slaves[index].alias = alias_addr; + + if (addr != 0 && alias_addr != 0) + dev_dbg(va->sd.dev, "%s rx port %d: map %02x to alias %02x\n", + __func__, sd->rx_port, addr, alias_addr); rval = ti960_reg_write(va, TI960_RX_PORT_SEL, - (rx_port << 4) + (1 << rx_port)); + (sd->rx_port << 4) + (1 << sd->rx_port)); if (rval) return rval; - return ti960_reg_write(va, TI960_SLAVE_ID0, addr); + if (addr != 0) { + rval = ti960_reg_write(va, TI960_SLAVE_ID0 + index, addr << 1); + if (rval) + return rval; + } + + if (alias_addr != 0) { + rval = ti960_reg_write(va, TI960_SLAVE_ALIAS_ID0 + index, alias_addr << 1); + if (rval) + return rval; + } + + return 0; } -static int ti960_map_alias_i2c_addr(struct ti960 *va, unsigned short rx_port, - unsigned short addr) +static int ti960_unmap_i2c_slave(struct ti960 *va, struct ti960_subdev *sd, + unsigned short addr) { int rval; + int index; + struct ti960_slave *slaves = sd->slaves; - rval = ti960_reg_write(va, TI960_RX_PORT_SEL, - (rx_port << 4) + (1 << rx_port)); + for (index = 0; index < NUM_ALIASES; index++) + if (slaves[index].addr == addr) + break; + + if (index >= NUM_ALIASES) + return 0; + + dev_dbg(va->sd.dev, "rx port %d: unmap %02x from alias %02x\n", + sd->rx_port, addr, slaves[index].alias); + slaves[index].addr = 0; + slaves[index].alias = 0; + + rval = ti960_reg_write(va, TI960_SLAVE_ID0 + index, 0); + if (rval) + return rval; + + rval = ti960_reg_write(va, TI960_SLAVE_ALIAS_ID0 + index, 0); if (rval) return rval; - return ti960_reg_write(va, TI960_SLAVE_ALIAS_ID0, addr); + return 0; } static int ti960_map_ser_alias_addr(struct ti960 *va, unsigned short rx_port, @@ -298,21 +362,24 @@ static int ti960_map_ser_alias_addr(struct ti960 *va, unsigned short rx_port, { int rval; - dev_dbg(va->sd.dev, "%s port %d, ser_alias %x\n", __func__, rx_port, ser_alias); + dev_err(va->sd.dev, "%s port %d, ser_alias %x\n", __func__, rx_port, ser_alias); rval = ti960_reg_write(va, TI960_RX_PORT_SEL, (rx_port << 4) + (1 << rx_port)); if (rval) return rval; - return ti960_reg_write(va, TI960_SER_ALIAS_ID, ser_alias); + return ti960_reg_write(va, TI960_SER_ALIAS_ID, ser_alias << 1); } -static int ti960_fsin_gpio_init(struct ti960 *va, unsigned short rx_port, - unsigned short ser_alias, unsigned short fsin_gpio) +static int ti960_fsin_gpio_init(struct ti960 *va, struct ti960_subdev *subdev) { unsigned char gpio_data; int rval; int reg_val; + unsigned short rx_port = subdev->rx_port; + unsigned short ser_alias = subdev->ser_i2c_addr; + unsigned short fsin_gpio = subdev->fsin_gpio; + struct i2c_client *serializer = subdev->serializer; dev_dbg(va->sd.dev, "%s\n", __func__); rval = regmap_read(va->regmap8, TI960_FS_CTL, ®_val); @@ -375,12 +442,12 @@ static int ti960_fsin_gpio_init(struct ti960 *va, unsigned short rx_port, } /* enable output and remote control */ - ti953_reg_write(&va->sd, rx_port, ser_alias, TI953_GPIO_INPUT_CTRL, TI953_GPIO_OUT_EN); - rval = ti953_reg_read(&va->sd, rx_port, ser_alias, TI953_LOCAL_GPIO_DATA, + ti953_reg_write(serializer, TI953_GPIO_INPUT_CTRL, TI953_GPIO_OUT_EN); + rval = ti953_reg_read(serializer, TI953_LOCAL_GPIO_DATA, &gpio_data); if (rval) return rval; - ti953_reg_write(&va->sd, rx_port, ser_alias, TI953_LOCAL_GPIO_DATA, + ti953_reg_write(serializer, TI953_LOCAL_GPIO_DATA, gpio_data | TI953_GPIO0_RMTEN << fsin_gpio); return rval; @@ -564,13 +631,8 @@ static int ti960_map_subdevs_addr(struct ti960 *va) if (!phy_i2c_addr || !alias_i2c_addr) continue; - rval = ti960_map_phy_i2c_addr(va, rx_port, phy_i2c_addr); - if (rval) - return rval; - - /* set 7bit alias i2c addr */ - rval = ti960_map_alias_i2c_addr(va, rx_port, - alias_i2c_addr << 1); + rval = ti960_map_i2c_slave(va, &va->sub_devs[i], + phy_i2c_addr, alias_i2c_addr); if (rval) return rval; } @@ -578,36 +640,81 @@ static int ti960_map_subdevs_addr(struct ti960 *va) return 0; } +static int gpio_exp_reset_sensor(struct i2c_client *client, int reset) +{ + s32 gpio_cfg; + s32 gpio_out; + + dev_dbg(&client->dev, "reset gpio %d", reset); + + gpio_cfg = i2c_smbus_read_byte_data(client, 0x03); + if (gpio_cfg < 0) + return gpio_cfg; + gpio_cfg &= ~(1u << reset); + i2c_smbus_write_byte_data(client, 0x03, gpio_cfg); + + gpio_out = i2c_smbus_read_byte_data(client, 0x01); + gpio_out &= ~(1u << reset); + i2c_smbus_write_byte_data(client, 0x01, gpio_out); + msleep(500); + gpio_out |= (1u << reset); + i2c_smbus_write_byte_data(client, 0x01, gpio_out); + + return 0; +} + /* * FIXME: workaround, reset to avoid block. */ -static int reset_sensor(struct ti960 *va, unsigned short rx_port, - unsigned short ser_alias, int reset) +static int ti953_reset_sensor(struct i2c_client *client, int reset) { int rval; unsigned char gpio_data; - rval = ti953_reg_read(&va->sd, rx_port, ser_alias, - TI953_LOCAL_GPIO_DATA, + rval = ti953_reg_read(client, TI953_LOCAL_GPIO_DATA, &gpio_data); if (rval) return rval; - ti953_reg_write(&va->sd, rx_port, ser_alias, TI953_GPIO_INPUT_CTRL, + ti953_reg_write(client, TI953_GPIO_INPUT_CTRL, TI953_GPIO_OUT_EN); gpio_data &= ~(TI953_GPIO0_RMTEN << reset); gpio_data &= ~(TI953_GPIO0_OUT << reset); - ti953_reg_write(&va->sd, rx_port, ser_alias, TI953_LOCAL_GPIO_DATA, + ti953_reg_write(client, TI953_LOCAL_GPIO_DATA, gpio_data); msleep(50); gpio_data |= TI953_GPIO0_OUT << reset; - ti953_reg_write(&va->sd, rx_port, ser_alias, TI953_LOCAL_GPIO_DATA, + ti953_reg_write(client, TI953_LOCAL_GPIO_DATA, gpio_data); - + msleep(500); return 0; } -static int ti960_config_ser(struct ti960 *va, struct ti960_subdev *subdev, +static int reset_sensor(struct ti960 *va, struct ti960_subdev *sd, + struct ti960_subdev_pdata *pdata) +{ + if (sd->gpio_exp) + return gpio_exp_reset_sensor(sd->gpio_exp, pdata->reset); + + if (sd->serializer) + return ti953_reset_sensor(sd->serializer, pdata->reset); + + return -ENODEV; +} + +static bool gpio_exp_detect(struct i2c_client *client) +{ + int rval; + + rval = i2c_smbus_read_byte_data(client, 0x03); + if (rval < 0) + return false; + + return (rval == 0xFF); +} + +static int ti960_config_ser(struct ti960 *va, struct i2c_client *client, int k, + struct ti960_subdev *subdev, struct ti960_subdev_pdata *pdata) { unsigned short rx_port, phy_i2c_addr, alias_i2c_addr, ser_i2c_addr; @@ -621,38 +728,72 @@ static int ti960_config_ser(struct ti960 *va, struct ti960_subdev *subdev, ser_i2c_addr = subdev->ser_i2c_addr; rval = ti960_map_ser_alias_addr(va, rx_port, - ser_i2c_addr << 1); + ser_i2c_addr); if (rval) return rval; - if (!ti953_detect(&va->sd, rx_port, ser_i2c_addr)) + subdev->serializer = i2c_new_dummy_device(client->adapter, ser_i2c_addr); + if (IS_ERR(subdev->serializer)) { + dev_err(va->sd.dev, "rx port %d: Failed to allocate serializer client: %ld", + rx_port, PTR_ERR(subdev->serializer)); + return -ENODEV; + } + + if (!ti953_detect(subdev->serializer)) { + dev_warn(va->sd.dev, "rx port %d: No link detected", + rx_port); + i2c_unregister_device(subdev->serializer); + subdev->serializer = NULL; return -ENODEV; + } + dev_info(va->sd.dev, "rx port: %d: Found serializer", rx_port); + va->sub_devs[k].serializer = subdev->serializer; - ti953_reg_write(&va->sd, rx_port, ser_i2c_addr, + rval = ti960_map_i2c_slave(va, &va->sub_devs[k], + D3_GPIO_EXP_ADDR, D3_GPIO_EXP_ALIAS(rx_port)); + if (rval) + return rval; + + subdev->gpio_exp = i2c_new_dummy_device(client->adapter, D3_GPIO_EXP_ALIAS(rx_port)); + if (IS_ERR(subdev->gpio_exp)) { + dev_err(va->sd.dev, "rx port %d: Failed to allocate gpio-expander client: %ld", + rx_port, PTR_ERR(subdev->gpio_exp)); + } else { + if (!gpio_exp_detect(subdev->gpio_exp)) { + dev_err(va->sd.dev, "rx port: %d: Missing gpio-expander", rx_port); + i2c_unregister_device(subdev->gpio_exp); + subdev->gpio_exp = NULL; + } else { + dev_info(va->sd.dev, "rx port: %d: Found gpio-expander", rx_port); + va->sub_devs[k].gpio_exp = subdev->gpio_exp; + } + } + + ti953_reg_write(subdev->serializer, TI953_RESET_CTL, TI953_DIGITAL_RESET_1); msleep(50); if (pdata->module_flags & TI960_FL_INIT_SER) { - rval = ti953_init(&va->sd, rx_port, ser_i2c_addr); + rval = ti953_init(subdev->serializer); if (rval) return rval; } if (pdata->module_flags & TI960_FL_INIT_SER_CLK) { - rval = ti953_init_clk(&va->sd, rx_port, ser_i2c_addr); + rval = ti953_init_clk(subdev->serializer); if (rval) return rval; } if (pdata->module_flags & TI960_FL_POWERUP) { - ti953_reg_write(&va->sd, rx_port, ser_i2c_addr, + ti953_reg_write(subdev->serializer, TI953_GPIO_INPUT_CTRL, TI953_GPIO_OUT_EN); /* boot sequence */ for (i = 0; i < TI960_MAX_GPIO_POWERUP_SEQ; i++) { if (pdata->gpio_powerup_seq[i] == (char)-1) break; - ti953_reg_write(&va->sd, rx_port, ser_i2c_addr, + ti953_reg_write(subdev->serializer, TI953_LOCAL_GPIO_DATA, pdata->gpio_powerup_seq[i]); msleep(50); @@ -660,7 +801,7 @@ static int ti960_config_ser(struct ti960 *va, struct ti960_subdev *subdev, } /* Configure ti953 CSI lane */ - rval = ti953_reg_read(&va->sd, rx_port, ser_i2c_addr, + rval = ti953_reg_read(subdev->serializer, TI953_GENERAL_CFG, &val); dev_dbg(va->sd.dev, "ti953 read default general CFG (%x)\n", val); if (va->pdata->ser_nlanes == 2) @@ -669,35 +810,31 @@ static int ti960_config_ser(struct ti960 *va, struct ti960_subdev *subdev, val |= TI953_CSI_4LANE; else dev_err(va->sd.dev, "not expected csi lane\n"); - rval = ti953_reg_write(&va->sd, rx_port, ser_i2c_addr, + rval = ti953_reg_write(subdev->serializer, TI953_GENERAL_CFG, val); if (rval != 0) { dev_err(va->sd.dev, "ti953 write failed(%d)\n", rval); return rval; } - ti953_bus_speed(&va->sd, rx_port, ser_i2c_addr, + ti953_bus_speed(subdev->serializer, TI953_I2C_SPEED_FAST_PLUS); speed_detect_fail = - ti953_reg_read(&va->sd, rx_port, - alias_i2c_addr, 0, &val); + ti953_reg_read(subdev->serializer, 0, &val); if (speed_detect_fail) { - ti953_bus_speed(&va->sd, rx_port, ser_i2c_addr, + ti953_bus_speed(subdev->serializer, TI953_I2C_SPEED_FAST); speed_detect_fail = - ti953_reg_read(&va->sd, rx_port, - alias_i2c_addr, 0, &val); + ti953_reg_read(subdev->serializer, 0, &val); } if (speed_detect_fail) { - ti953_bus_speed(&va->sd, rx_port, ser_i2c_addr, + ti953_bus_speed(subdev->serializer, TI953_I2C_SPEED_STANDARD); speed_detect_fail = - ti953_reg_read(&va->sd, rx_port, - alias_i2c_addr, 0, &val); + ti953_reg_read(subdev->serializer, 0, &val); } if (speed_detect_fail) dev_err(va->sd.dev, "i2c bus speed standard failed!"); - return 0; } @@ -711,7 +848,6 @@ static int ti960_registered(struct v4l2_subdev *subdev) for (i = 0 ; i < NR_OF_TI960_SINK_PADS; i++) port_registered[i] = false; - for (i = 0, k = 0; i < va->pdata->subdev_num; i++) { struct ti960_subdev_info *info = &va->pdata->subdev_info[i]; @@ -719,12 +855,10 @@ static int ti960_registered(struct v4l2_subdev *subdev) (struct ti960_subdev_pdata *) info->board_info.platform_data; struct ti960_subdev sensor_subdev; - sensor_subdev.rx_port = info->rx_port; sensor_subdev.phy_i2c_addr = info->phy_i2c_addr; sensor_subdev.alias_i2c_addr = info->board_info.addr; sensor_subdev.ser_i2c_addr = info->ser_alias; - if (k >= va->nsinks) break; @@ -742,7 +876,7 @@ static int ti960_registered(struct v4l2_subdev *subdev) memcpy(&va->subdev_pdata[k], pdata, sizeof(*pdata)); va->sub_devs[k].fsin_gpio = va->subdev_pdata[k].fsin; - + va->sub_devs[k].rx_port = info->rx_port; /* Spin sensor subdev suffix name */ va->subdev_pdata[k].suffix = info->suffix; @@ -759,22 +893,17 @@ static int ti960_registered(struct v4l2_subdev *subdev) dev_err(va->sd.dev, "can't find the physical and alias addr.\n"); return -EINVAL; } - - rval = ti960_config_ser(va, &sensor_subdev, pdata); + rval = ti960_config_ser(va, client, k, &sensor_subdev, pdata); if (rval) continue; - /* Map PHY I2C address. */ - rval = ti960_map_phy_i2c_addr(va, info->rx_port, - info->phy_i2c_addr); - if (rval) - return rval; + reset_sensor(va, &va->sub_devs[k], &va->subdev_pdata[k]); - /* Map 7bit ALIAS I2C address. */ - rval = ti960_map_alias_i2c_addr(va, info->rx_port, - info->board_info.addr << 1); + /* Map slave I2C address. */ + rval = ti960_map_i2c_slave(va, &va->sub_devs[k], + info->phy_i2c_addr, info->board_info.addr); if (rval) - return rval; + continue; va->sub_devs[k].sd = v4l2_i2c_new_subdev_board( va->sd.v4l2_dev, client->adapter, @@ -785,7 +914,6 @@ static int ti960_registered(struct v4l2_subdev *subdev) info->suffix); continue; } - va->sub_devs[k].rx_port = info->rx_port; va->sub_devs[k].phy_i2c_addr = info->phy_i2c_addr; va->sub_devs[k].alias_i2c_addr = info->board_info.addr; va->sub_devs[k].ser_i2c_addr = info->ser_alias; @@ -812,8 +940,8 @@ static int ti960_registered(struct v4l2_subdev *subdev) for (l = 0; l < va->nsinks; l++) { rval = media_create_pad_link( - &va->sub_devs[k].sd->entity, j, - &va->sd.entity, l, MEDIA_LNK_FL_DYNAMIC); + &va->sub_devs[k].sd->entity, j, + &va->sd.entity, l, MEDIA_LNK_FL_DYNAMIC); if (rval) { dev_err(va->sd.dev, "can't create link to %c\n", @@ -1047,8 +1175,8 @@ static int ti960_set_stream(struct v4l2_subdev *subdev, int enable) if (broadcast && sd_idx == -1) { sd_idx = j; } else if (broadcast) { - rval = ti960_map_alias_i2c_addr(va, rx_port, - va->sub_devs[sd_idx].alias_i2c_addr << 1); + rval = ti960_map_i2c_slave(va, rx_port, 0, + va->sub_devs[sd_idx].alias_i2c_addr); if (rval < 0) return rval; } else { @@ -1074,8 +1202,7 @@ static int ti960_set_stream(struct v4l2_subdev *subdev, int enable) return rval; } if (va->subdev_pdata[j].module_flags & TI960_FL_RESET) { - rval = reset_sensor(va, rx_port, ser_alias, - va->subdev_pdata[j].reset); + rval = reset_sensor(va, &va->sub_devs[j], &va->subdev_pdata[j]); if (rval) return rval; } @@ -1105,10 +1232,7 @@ static int ti960_set_stream(struct v4l2_subdev *subdev, int enable) for (i = 0; i < NR_OF_TI960_SINK_PADS; i++) { if (enable && test_bit(i, rx_port_enabled)) { - rval = ti960_fsin_gpio_init(va, - va->sub_devs[i].rx_port, - va->sub_devs[i].ser_i2c_addr, - va->sub_devs[i].fsin_gpio); + rval = ti960_fsin_gpio_init(va, &va->sub_devs[i]); if (rval) { dev_err(va->sd.dev, "Failed to enable frame sync gpio init.\n"); @@ -1118,8 +1242,8 @@ static int ti960_set_stream(struct v4l2_subdev *subdev, int enable) if (va->subdev_pdata[i].module_flags & TI960_FL_RESET) { rx_port = va->sub_devs[i].rx_port; ser_alias = va->sub_devs[i].ser_i2c_addr; - rval = reset_sensor(va, rx_port, ser_alias, - va->subdev_pdata[i].reset); + rval = reset_sensor(va, &va->sub_devs[i], + &va->subdev_pdata[i]); if (rval) return rval; } @@ -1140,7 +1264,6 @@ static int ti960_set_stream(struct v4l2_subdev *subdev, int enable) return rval; } } - /* * Restore each subdev i2c address as we may * touch it later. @@ -1192,8 +1315,7 @@ static int ti960_set_stream_vc(struct ti960 *va, u8 vc_id, u8 state) return rval; } if (va->subdev_pdata[i].module_flags & TI960_FL_RESET) { - rval = reset_sensor(va, rx_port, ser_alias, - va->subdev_pdata[i].reset); + rval = reset_sensor(va, &va->sub_devs[i], &va->subdev_pdata[i]); if (rval) return rval; } @@ -1603,6 +1725,12 @@ static int ti960_probe(struct i2c_client *client, gpio_set_value(va->pdata->FPD_gpio, 1); } + va->bus_switch = i2c_new_dummy_device(client->adapter, D3_BUS_SWITCH_ADDR); + if (IS_ERR(va->bus_switch)) { + dev_warn(&client->dev, "Failed to create client for bus-switch: %ld", + PTR_ERR(va->bus_switch)); + va->bus_switch = 0; + } rval = ti960_init(va); if (rval) { dev_err(&client->dev, "Failed to init TI960!\n"); @@ -1667,6 +1795,20 @@ static void ti960_remove(struct i2c_client *client) i2c_unregister_device(sub_client); } va->sub_devs[i].sd = NULL; + if (va->sub_devs[i].serializer) { + i2c_unregister_device(va->sub_devs[i].serializer); + va->sub_devs[i].serializer = NULL; + } + + if (va->sub_devs[i].gpio_exp) { + i2c_unregister_device(va->sub_devs[i].gpio_exp); + va->sub_devs[i].gpio_exp = NULL; + } + } + + if (va->bus_switch) { + i2c_unregister_device(va->bus_switch); + va->bus_switch = NULL; } gpiochip_remove(&va->gc); @@ -1701,7 +1843,7 @@ static int ti960_resume(struct device *dev) if (sensor_subdev->sd == NULL) break; - rval = ti960_config_ser(va, sensor_subdev, pdata); + rval = ti960_config_ser(va, client, i, sensor_subdev, pdata); if (rval) dev_warn(va->sd.dev, "resume: failed config subdev"); } diff --git a/drivers/media/platform/intel/ipu6-acpi-pdata.c b/drivers/media/platform/intel/ipu6-acpi-pdata.c index a891da26c1ab..92d53c5d7504 100644 --- a/drivers/media/platform/intel/ipu6-acpi-pdata.c +++ b/drivers/media/platform/intel/ipu6-acpi-pdata.c @@ -580,14 +580,14 @@ static void set_i2c(struct ipu_isys_subdev_info **sensor_sd, } static void set_serdes_sd_pdata(struct serdes_module_pdata **module_pdata, char sensor_name[I2C_NAME_SIZE], - unsigned int lanes) + const char *hid_name, unsigned int lanes) { /* general */ (*module_pdata)->lanes = lanes; strscpy((*module_pdata)->module_name, sensor_name, I2C_NAME_SIZE); /* TI960 and IMX390 specific */ - if (!strcmp(sensor_name, IMX390_NAME)) { + if (!strcmp(sensor_name, IMX390_NAME) && !strcmp(hid_name, "INTC10C1")) { (*module_pdata)->gpio_powerup_seq[0] = 0; (*module_pdata)->gpio_powerup_seq[1] = 0x9; (*module_pdata)->gpio_powerup_seq[2] = -1; @@ -596,6 +596,16 @@ static void set_serdes_sd_pdata(struct serdes_module_pdata **module_pdata, char (*module_pdata)->fsin = 3; } + /* TI960 and IMX390 specific */ + if (!strcmp(sensor_name, IMX390_NAME) && !strcmp(hid_name, "INTC10CM")) { + (*module_pdata)->gpio_powerup_seq[0] = 0; + (*module_pdata)->gpio_powerup_seq[1] = 0xa; + (*module_pdata)->gpio_powerup_seq[2] = -1; + (*module_pdata)->gpio_powerup_seq[3] = -1; + (*module_pdata)->module_flags = TI960_FL_POWERUP | TI960_FL_INIT_SER_CLK; + (*module_pdata)->fsin = 0; + } + /* TI960 and ISX031 specific */ if (!strcmp(sensor_name, ISX031_NAME)) { (*module_pdata)->gpio_powerup_seq[0] = 0x0; @@ -613,6 +623,7 @@ static int set_serdes_subdev(struct ipu_isys_subdev_info **serdes_sd, struct device *dev, struct serdes_platform_data **pdata, char sensor_name[I2C_NAME_SIZE], + const char *hid_name, unsigned int lanes, unsigned int addr, unsigned int subdev_port) @@ -633,7 +644,7 @@ static int set_serdes_subdev(struct ipu_isys_subdev_info **serdes_sd, return -ENOMEM; } - set_serdes_sd_pdata(&module_pdata[i], sensor_name, lanes); + set_serdes_sd_pdata(&module_pdata[i], sensor_name, hid_name, lanes); /* board info */ strscpy(serdes_sdinfo[i].board_info.type, sensor_name, I2C_NAME_SIZE); @@ -673,6 +684,7 @@ static u8 suffix_offset = 1; static int set_pdata(struct ipu_isys_subdev_info **sensor_sd, struct device *dev, char sensor_name[I2C_NAME_SIZE], + const char *hid_name, struct control_logic_data *ctl_data, unsigned int port, unsigned int lanes, @@ -740,7 +752,7 @@ static int set_pdata(struct ipu_isys_subdev_info **sensor_sd, } pdata->deser_nlanes = deser_lanes; pdata->ser_nlanes = lanes; - set_serdes_subdev(sensor_sd, dev, &pdata, sensor_name, lanes, addr, rx_port); + set_serdes_subdev(sensor_sd, dev, &pdata, sensor_name, hid_name, lanes, addr, rx_port); (*sensor_sd)->i2c.board_info.platform_data = pdata; pdata->deser_board_info = &(*sensor_sd)->i2c.board_info; @@ -780,13 +792,14 @@ static void set_serdes_info(struct device *dev, char *sensor_name, const char *s if (!strcmp(sensor_name, IMX390_NAME)) serdes_info.phy_i2c_addr = IMX390_D3CM_I2C_ADDRESS; else if (!strcmp(sensor_name, ISX031_NAME)) - serdes_info.phy_i2c_addr = ISX031_I2C_ADDRESS_8BIT; + serdes_info.phy_i2c_addr = ISX031_I2C_ADDRESS; else serdes_info.phy_i2c_addr = 0; } static int populate_dummy(struct device *dev, char sensor_name[I2C_NAME_SIZE], + const char *hid_name, struct sensor_bios_data *cam_data, struct control_logic_data *ctl_data, enum connection_type connect) @@ -809,7 +822,7 @@ static int populate_dummy(struct device *dev, set_i2c(&dummy, dev, sensor_name, addr_dummy); - ret = set_pdata(&dummy, dev, sensor_name, ctl_data, cam_data->pprval, + ret = set_pdata(&dummy, dev, sensor_name, hid_name, ctl_data, cam_data->pprval, cam_data->lanes, addr_dummy, 0, 0, true, connect); if (ret) { kfree(dummy); @@ -827,7 +840,8 @@ static int populate_sensor_pdata(struct device *dev, struct sensor_bios_data *cam_data, struct control_logic_data *ctl_data, enum connection_type connect, - const char *serdes_name) + const char *serdes_name, + const char *hid_name) { int ret; @@ -892,7 +906,7 @@ static int populate_sensor_pdata(struct device *dev, } /* Use last I2C device */ - ret = set_pdata(sensor_sd, dev, sensor_name, ctl_data, cam_data->link, + ret = set_pdata(sensor_sd, dev, sensor_name, hid_name, ctl_data, cam_data->link, cam_data->lanes, cam_data->i2c[cam_data->i2c_num - 1].addr, cam_data->pprunit, cam_data->pprval, false, connect); @@ -904,7 +918,7 @@ static int populate_sensor_pdata(struct device *dev, /* Lontium specific */ if (!strcmp(sensor_name, LT6911UXC_NAME) || !strcmp(sensor_name, LT6911UXE_NAME)) { if (cam_data->pprval != cam_data->link) { - ret = populate_dummy(dev, sensor_name, cam_data, ctl_data, connect); + ret = populate_dummy(dev, sensor_name, hid_name, cam_data, ctl_data, connect); if (ret) return ret; } @@ -917,7 +931,7 @@ int get_sensor_pdata(struct i2c_client *client, struct ipu_camera_module_data *data, struct ipu_i2c_helper *helper, void *priv, size_t size, - enum connection_type connect, const char *serdes_name) + enum connection_type connect, const char *serdes_name, const char *hid_name) { struct sensor_bios_data *cam_data; struct control_logic_data *ctl_data; @@ -965,7 +979,7 @@ int get_sensor_pdata(struct i2c_client *client, /* populate pdata */ rval = populate_sensor_pdata(&client->dev, &sensor_sd, - client->name, cam_data, ctl_data, connect, serdes_name); + client->name, cam_data, ctl_data, connect, serdes_name, hid_name); if (rval) { kfree(sensor_sd); kfree(cam_data); diff --git a/drivers/media/platform/intel/ipu6-acpi.c b/drivers/media/platform/intel/ipu6-acpi.c index 51eb5b00f816..e6dd7c3d708a 100644 --- a/drivers/media/platform/intel/ipu6-acpi.c +++ b/drivers/media/platform/intel/ipu6-acpi.c @@ -66,6 +66,7 @@ static const struct ipu_acpi_devices supported_devices[] = { { "INTC10C0", AR0234_NAME, get_sensor_pdata, NULL, 0, TYPE_DIRECT, NULL }, // AR0234 HID { "INTC10B1", LT6911UXC_NAME, get_sensor_pdata, NULL, 0, TYPE_DIRECT, NULL }, // LT6911UXC HID { "INTC10C1", IMX390_NAME, get_sensor_pdata, NULL, 0, TYPE_SERDES, TI960_NAME },// IMX390 HID + { "INTC10CM", IMX390_NAME, get_sensor_pdata, NULL, 0, TYPE_SERDES, TI960_NAME },// new D3 IMX390 HID { "INTC1031", ISX031_NAME, get_sensor_pdata, NULL, 0, TYPE_SERDES, TI960_NAME },// ISX031 HID { "INTC10C5", LT6911UXE_NAME, get_sensor_pdata, NULL, 0, TYPE_DIRECT, NULL }, // LT6911UXE HID { "INTC10CD", D457_NAME, get_sensor_pdata, NULL, 0, TYPE_SERDES, D457_NAME },// D457 HID @@ -92,6 +93,7 @@ static const struct acpi_device_id ipu_acpi_match[] = { { "INTC10C0", 0 }, // AR0234 HID { "INTC10B1", 0 }, // LT6911UXC HID { "INTC10C1", 0 }, // IMX390 HID + { "INTC10CM", 0 }, // D3CMC68N-106-085 IMX390 HID { "INTC1031", 0 }, // ISX031 HID { "INTC10C5", 0 }, // LT6911UXE HID { "INTC10CD", 0 }, // D457 HID @@ -123,7 +125,8 @@ static int ipu_acpi_get_pdata(struct i2c_client *client, supported_devices[index].priv_data, supported_devices[index].priv_size, supported_devices[index].connect, - supported_devices[index].serdes_name); + supported_devices[index].serdes_name, + supported_devices[index].hid_name); return 0; } diff --git a/drivers/media/platform/intel/ipu6-adlrvp-pdata.c b/drivers/media/platform/intel/ipu6-adlrvp-pdata.c index d6f417f791b5..cc5857ec99bb 100644 --- a/drivers/media/platform/intel/ipu6-adlrvp-pdata.c +++ b/drivers/media/platform/intel/ipu6-adlrvp-pdata.c @@ -123,12 +123,8 @@ static struct ipu_isys_subdev_info ar0234_sd_2 = { #if IS_ENABLED(CONFIG_VIDEO_IMX390) #define IMX390_LANES 4 #define IMX390_D3RCM_I2C_ADDRESS 0x1a -#define IMX390_D3RCM_I2C_ADDRESS_8BIT (IMX390_D3RCM_I2C_ADDRESS << 1) -#define IMX390_D3CM_I2C_ADDRESS_8BIT (IMX390_D3CM_I2C_ADDRESS << 1) #define IMX390_I2C_ADDRESS_3 0x1e -#define IMX390_I2C_ADDRESS_8BIT_3 (IMX390_I2C_ADDRESS_3 << 1) #define IMX390_I2C_ADDRESS_4 0x20 -#define IMX390_I2C_ADDRESS_8BIT_4 (IMX390_I2C_ADDRESS_4 << 1) #endif @@ -203,7 +199,7 @@ static struct ti960_subdev_info ti960_subdevs_1[] = { .platform_data = &isx031_pdata_stub, }, .rx_port = 0, - .phy_i2c_addr = ISX031_I2C_ADDRESS_8BIT, + .phy_i2c_addr = ISX031_I2C_ADDRESS, .ser_alias = ISX031A_SER_ADDRESS, .suffix = 'a', }, @@ -214,7 +210,7 @@ static struct ti960_subdev_info ti960_subdevs_1[] = { .platform_data = &isx031_pdata_stub, }, .rx_port = 1, - .phy_i2c_addr = ISX031_I2C_ADDRESS_8BIT, + .phy_i2c_addr = ISX031_I2C_ADDRESS, .ser_alias = ISX031B_SER_ADDRESS, .suffix = 'b', }, @@ -225,7 +221,7 @@ static struct ti960_subdev_info ti960_subdevs_1[] = { .platform_data = &isx031_pdata_stub, }, .rx_port = 2, - .phy_i2c_addr = ISX031_I2C_ADDRESS_8BIT, + .phy_i2c_addr = ISX031_I2C_ADDRESS, .ser_alias = ISX031C_SER_ADDRESS, .suffix = 'c', }, @@ -236,7 +232,7 @@ static struct ti960_subdev_info ti960_subdevs_1[] = { .platform_data = &isx031_pdata_stub, }, .rx_port = 3, - .phy_i2c_addr = ISX031_I2C_ADDRESS_8BIT, + .phy_i2c_addr = ISX031_I2C_ADDRESS, .ser_alias = ISX031D_SER_ADDRESS, .suffix = 'd', }, @@ -250,7 +246,7 @@ static struct ti960_subdev_info ti960_subdevs_1[] = { .platform_data = &imx390_d3rcm_pdata_stub, }, .rx_port = 0, - .phy_i2c_addr = IMX390_D3RCM_I2C_ADDRESS_8BIT, + .phy_i2c_addr = IMX390_D3RCM_I2C_ADDRESS, .ser_alias = IMX390A_SER_ADDRESS, .suffix = 'a', }, @@ -261,7 +257,7 @@ static struct ti960_subdev_info ti960_subdevs_1[] = { .platform_data = &imx390_d3rcm_pdata_stub, }, .rx_port = 1, - .phy_i2c_addr = IMX390_D3RCM_I2C_ADDRESS_8BIT, + .phy_i2c_addr = IMX390_D3RCM_I2C_ADDRESS, .ser_alias = IMX390B_SER_ADDRESS, .suffix = 'b', }, @@ -272,7 +268,7 @@ static struct ti960_subdev_info ti960_subdevs_1[] = { .platform_data = &imx390_d3rcm_pdata_stub, }, .rx_port = 2, - .phy_i2c_addr = IMX390_D3RCM_I2C_ADDRESS_8BIT, + .phy_i2c_addr = IMX390_D3RCM_I2C_ADDRESS, .ser_alias = IMX390C_SER_ADDRESS, .suffix = 'c', }, @@ -283,7 +279,7 @@ static struct ti960_subdev_info ti960_subdevs_1[] = { .platform_data = &imx390_d3rcm_pdata_stub, }, .rx_port = 3, - .phy_i2c_addr = IMX390_D3RCM_I2C_ADDRESS_8BIT, + .phy_i2c_addr = IMX390_D3RCM_I2C_ADDRESS, .ser_alias = IMX390D_SER_ADDRESS, .suffix = 'd', }, @@ -295,7 +291,7 @@ static struct ti960_subdev_info ti960_subdevs_1[] = { .platform_data = &imx390_d3cm_pdata_stub, }, .rx_port = 0, - .phy_i2c_addr = IMX390_D3CM_I2C_ADDRESS_8BIT, + .phy_i2c_addr = IMX390_D3CM_I2C_ADDRESS, .ser_alias = IMX390A_SER_ADDRESS, .suffix = 'a', }, @@ -306,7 +302,7 @@ static struct ti960_subdev_info ti960_subdevs_1[] = { .platform_data = &imx390_d3cm_pdata_stub, }, .rx_port = 1, - .phy_i2c_addr = IMX390_D3CM_I2C_ADDRESS_8BIT, + .phy_i2c_addr = IMX390_D3CM_I2C_ADDRESS, .ser_alias = IMX390B_SER_ADDRESS, .suffix = 'b', }, @@ -317,7 +313,7 @@ static struct ti960_subdev_info ti960_subdevs_1[] = { .platform_data = &imx390_d3cm_pdata_stub, }, .rx_port = 2, - .phy_i2c_addr = IMX390_D3CM_I2C_ADDRESS_8BIT, + .phy_i2c_addr = IMX390_D3CM_I2C_ADDRESS, .ser_alias = IMX390C_SER_ADDRESS, .suffix = 'c', }, @@ -328,7 +324,7 @@ static struct ti960_subdev_info ti960_subdevs_1[] = { .platform_data = &imx390_d3cm_pdata_stub, }, .rx_port = 3, - .phy_i2c_addr = IMX390_D3CM_I2C_ADDRESS_8BIT, + .phy_i2c_addr = IMX390_D3CM_I2C_ADDRESS, .ser_alias = IMX390D_SER_ADDRESS, .suffix = 'd', }, @@ -344,7 +340,7 @@ static struct ti960_subdev_info ti960_subdevs_2[] = { .platform_data = &isx031_pdata_stub, }, .rx_port = 0, - .phy_i2c_addr = ISX031_I2C_ADDRESS_8BIT, + .phy_i2c_addr = ISX031_I2C_ADDRESS, .ser_alias = ISX031A_SER_ADDRESS, .suffix = 'e', }, @@ -355,7 +351,7 @@ static struct ti960_subdev_info ti960_subdevs_2[] = { .platform_data = &isx031_pdata_stub, }, .rx_port = 1, - .phy_i2c_addr = ISX031_I2C_ADDRESS_8BIT, + .phy_i2c_addr = ISX031_I2C_ADDRESS, .ser_alias = ISX031B_SER_ADDRESS, .suffix = 'f', }, @@ -366,7 +362,7 @@ static struct ti960_subdev_info ti960_subdevs_2[] = { .platform_data = &isx031_pdata_stub, }, .rx_port = 2, - .phy_i2c_addr = ISX031_I2C_ADDRESS_8BIT, + .phy_i2c_addr = ISX031_I2C_ADDRESS, .ser_alias = ISX031C_SER_ADDRESS, .suffix = 'g', }, @@ -377,7 +373,7 @@ static struct ti960_subdev_info ti960_subdevs_2[] = { .platform_data = &isx031_pdata_stub, }, .rx_port = 3, - .phy_i2c_addr = ISX031_I2C_ADDRESS_8BIT, + .phy_i2c_addr = ISX031_I2C_ADDRESS, .ser_alias = ISX031D_SER_ADDRESS, .suffix = 'h', }, diff --git a/drivers/media/platform/intel/ipu6-tglrvp-pdata.c b/drivers/media/platform/intel/ipu6-tglrvp-pdata.c index a0f316e3050e..d4a9ede8c5da 100644 --- a/drivers/media/platform/intel/ipu6-tglrvp-pdata.c +++ b/drivers/media/platform/intel/ipu6-tglrvp-pdata.c @@ -223,12 +223,8 @@ static struct ipu_isys_subdev_info ar0234_sd_4 = { #if IS_ENABLED(CONFIG_VIDEO_IMX390) #define IMX390_LANES 4 #define IMX390_D3RCM_I2C_ADDRESS 0x1a -#define IMX390_D3RCM_I2C_ADDRESS_8BIT (IMX390_D3RCM_I2C_ADDRESS << 1) -#define IMX390_D3CM_I2C_ADDRESS_8BIT (IMX390_D3CM_I2C_ADDRESS << 1) #define IMX390_I2C_ADDRESS_3 0x1e -#define IMX390_I2C_ADDRESS_8BIT_3 (IMX390_I2C_ADDRESS_3 << 1) #define IMX390_I2C_ADDRESS_4 0x20 -#define IMX390_I2C_ADDRESS_8BIT_4 (IMX390_I2C_ADDRESS_4 << 1) static struct ipu_isys_csi2_config imx390_csi2_cfg_1 = { .nlanes = IMX390_LANES, @@ -345,7 +341,7 @@ static struct ti960_subdev_info ti960_subdevs[] = { .platform_data = &imx390_d3rcm_pdata_stub, }, .rx_port = 0, - .phy_i2c_addr = IMX390_D3RCM_I2C_ADDRESS_8BIT, + .phy_i2c_addr = IMX390_D3RCM_I2C_ADDRESS, .ser_alias = IMX390A_SER_ADDRESS, .suffix = 'a', }, @@ -356,7 +352,7 @@ static struct ti960_subdev_info ti960_subdevs[] = { .platform_data = &imx390_d3rcm_pdata_stub, }, .rx_port = 1, - .phy_i2c_addr = IMX390_D3RCM_I2C_ADDRESS_8BIT, + .phy_i2c_addr = IMX390_D3RCM_I2C_ADDRESS, .ser_alias = IMX390B_SER_ADDRESS, .suffix = 'b', }, @@ -367,7 +363,7 @@ static struct ti960_subdev_info ti960_subdevs[] = { .platform_data = &imx390_d3rcm_pdata_stub, }, .rx_port = 2, - .phy_i2c_addr = IMX390_D3RCM_I2C_ADDRESS_8BIT, + .phy_i2c_addr = IMX390_D3RCM_I2C_ADDRESS, .ser_alias = IMX390C_SER_ADDRESS, .suffix = 'c', }, @@ -378,7 +374,7 @@ static struct ti960_subdev_info ti960_subdevs[] = { .platform_data = &imx390_d3rcm_pdata_stub, }, .rx_port = 3, - .phy_i2c_addr = IMX390_D3RCM_I2C_ADDRESS_8BIT, + .phy_i2c_addr = IMX390_D3RCM_I2C_ADDRESS, .ser_alias = IMX390D_SER_ADDRESS, .suffix = 'd', }, @@ -390,7 +386,7 @@ static struct ti960_subdev_info ti960_subdevs[] = { .platform_data = &imx390_d3cm_pdata_stub, }, .rx_port = 0, - .phy_i2c_addr = IMX390_D3CM_I2C_ADDRESS_8BIT, + .phy_i2c_addr = IMX390_D3CM_I2C_ADDRESS, .ser_alias = IMX390A_SER_ADDRESS, .suffix = 'a', }, @@ -401,7 +397,7 @@ static struct ti960_subdev_info ti960_subdevs[] = { .platform_data = &imx390_d3cm_pdata_stub, }, .rx_port = 1, - .phy_i2c_addr = IMX390_D3CM_I2C_ADDRESS_8BIT, + .phy_i2c_addr = IMX390_D3CM_I2C_ADDRESS, .ser_alias = IMX390B_SER_ADDRESS, .suffix = 'b', }, @@ -412,7 +408,7 @@ static struct ti960_subdev_info ti960_subdevs[] = { .platform_data = &imx390_d3cm_pdata_stub, }, .rx_port = 2, - .phy_i2c_addr = IMX390_D3CM_I2C_ADDRESS_8BIT, + .phy_i2c_addr = IMX390_D3CM_I2C_ADDRESS, .ser_alias = IMX390C_SER_ADDRESS, .suffix = 'c', }, @@ -423,7 +419,7 @@ static struct ti960_subdev_info ti960_subdevs[] = { .platform_data = &imx390_d3cm_pdata_stub, }, .rx_port = 3, - .phy_i2c_addr = IMX390_D3CM_I2C_ADDRESS_8BIT, + .phy_i2c_addr = IMX390_D3CM_I2C_ADDRESS, .ser_alias = IMX390D_SER_ADDRESS, .suffix = 'd', }, diff --git a/include/media/imx390.h b/include/media/imx390.h index be95249fbe96..41e7d6fccfeb 100644 --- a/include/media/imx390.h +++ b/include/media/imx390.h @@ -8,7 +8,7 @@ #define IMX390_NAME "imx390" -#define IMX390_D3CM_I2C_ADDRESS (0x21 << 1) +#define IMX390_D3CM_I2C_ADDRESS 0x21 struct imx390_platform_data { unsigned int port; diff --git a/include/media/ipu-acpi-pdata.h b/include/media/ipu-acpi-pdata.h index 9b241cf19ae0..e9849078e988 100644 --- a/include/media/ipu-acpi-pdata.h +++ b/include/media/ipu-acpi-pdata.h @@ -22,7 +22,8 @@ int get_sensor_pdata(struct i2c_client *client, struct ipu_i2c_helper *helper, void *priv, size_t size, enum connection_type connect, - const char *serdes_name); + const char *serdes_name, + const char *hid_name); struct ipu_isys_subdev_pdata *get_acpi_subdev_pdata(void); diff --git a/include/media/ipu-acpi.h b/include/media/ipu-acpi.h index 67953db42715..8b6a92c47812 100644 --- a/include/media/ipu-acpi.h +++ b/include/media/ipu-acpi.h @@ -195,7 +195,8 @@ struct ipu_acpi_devices { void *priv, size_t size, enum connection_type type, - const char *serdes_name); + const char *serdes_name, + const char *hid_name); void *priv_data; size_t priv_size; enum connection_type connect; diff --git a/include/media/isx031.h b/include/media/isx031.h index 36c9f3d330ce..e703e001db6b 100644 --- a/include/media/isx031.h +++ b/include/media/isx031.h @@ -9,7 +9,6 @@ #define ISX031_NAME "isx031" #define ISX031_I2C_ADDRESS 0x1a -#define ISX031_I2C_ADDRESS_8BIT (ISX031_I2C_ADDRESS << 1) struct isx031_platform_data { unsigned int port;