diff options
author | Vincent Knecht | 2023-12-01 19:13:50 +0100 |
---|---|---|
committer | Hans Verkuil | 2023-12-13 13:21:19 +0100 |
commit | df15385e6793e62f1537c5069680ac12049b4a5f (patch) | |
tree | d311950302aa478daafcd6940d9a2bd882f0ce9d /drivers/media | |
parent | f8e004714a94ae683771529c5795c6ee4612dd8c (diff) |
media: i2c: ak7375: Add support for ak7345
Add support for ak7345 VCM, which has 9 bits position values,
longer power-up delay, and no known standby register setting.
Might be compatible as-is with ak7348.
Tested on msm8916-alcatel-idol347 phone.
Signed-off-by: Vincent Knecht <vincent.knecht@mailoo.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/i2c/ak7375.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/drivers/media/i2c/ak7375.c b/drivers/media/i2c/ak7375.c index 3a14eff41531..9a2432cea3ff 100644 --- a/drivers/media/i2c/ak7375.c +++ b/drivers/media/i2c/ak7375.c @@ -16,6 +16,7 @@ struct ak73xx_chipdef { u8 shift_pos; u8 mode_active; u8 mode_standby; + bool has_standby; /* Some chips may not have standby mode */ u16 focus_pos_max; /* * This sets the minimum granularity for the focus positions. @@ -37,12 +38,26 @@ struct ak73xx_chipdef { u16 power_delay_us; }; +static const struct ak73xx_chipdef ak7345_cdef = { + .reg_position = 0x0, + .reg_cont = 0x2, + .shift_pos = 7, /* 9 bits position values, need to << 7 */ + .mode_active = 0x0, + .has_standby = false, + .focus_pos_max = 511, + .focus_steps = 1, + .ctrl_steps = 16, + .ctrl_delay_us = 1000, + .power_delay_us = 20000, +}; + static const struct ak73xx_chipdef ak7375_cdef = { .reg_position = 0x0, .reg_cont = 0x2, .shift_pos = 4, /* 12 bits position values, need to << 4 */ .mode_active = 0x0, .mode_standby = 0x40, + .has_standby = true, .focus_pos_max = 4095, .focus_steps = 1, .ctrl_steps = 64, @@ -249,10 +264,12 @@ static int __maybe_unused ak7375_vcm_suspend(struct device *dev) usleep_range(cdef->ctrl_delay_us, cdef->ctrl_delay_us + 10); } - ret = ak7375_i2c_write(ak7375_dev, cdef->reg_cont, - cdef->mode_standby, 1); - if (ret) - dev_err(dev, "%s I2C failure: %d\n", __func__, ret); + if (cdef->has_standby) { + ret = ak7375_i2c_write(ak7375_dev, cdef->reg_cont, + cdef->mode_standby, 1); + if (ret) + dev_err(dev, "%s I2C failure: %d\n", __func__, ret); + } ret = regulator_bulk_disable(ARRAY_SIZE(ak7375_supply_names), ak7375_dev->supplies); @@ -312,6 +329,7 @@ static int __maybe_unused ak7375_vcm_resume(struct device *dev) } static const struct of_device_id ak7375_of_table[] = { + { .compatible = "asahi-kasei,ak7345", .data = &ak7345_cdef, }, { .compatible = "asahi-kasei,ak7375", .data = &ak7375_cdef, }, { /* sentinel */ } }; |