The smiapp_probe() is the sole caller of smiapp_init(). Unify the two.
Signed-off-by: Sakari Ailus
---
drivers/media/i2c/smiapp/smiapp-core.c | 425 -
1 file changed, 205 insertions(+), 220 deletions(-)
diff --git a/drivers/media/i2c/smiapp/smiapp-core.c
b/drivers/media/i2c/smiapp/smiapp-core.c
index 13322f3..0b5671c 100644
--- a/drivers/media/i2c/smiapp/smiapp-core.c
+++ b/drivers/media/i2c/smiapp/smiapp-core.c
@@ -2605,224 +2605,6 @@ static void smiapp_create_subdev(struct smiapp_sensor
*sensor,
v4l2_set_subdevdata(>sd, client);
}
-static int smiapp_init(struct smiapp_sensor *sensor)
-{
- struct i2c_client *client = v4l2_get_subdevdata(>src->sd);
- struct smiapp_pll *pll = >pll;
- unsigned int i;
- int rval;
-
- sensor->vana = devm_regulator_get(>dev, "vana");
- if (IS_ERR(sensor->vana)) {
- dev_err(>dev, "could not get regulator for vana\n");
- return PTR_ERR(sensor->vana);
- }
-
- sensor->ext_clk = devm_clk_get(>dev, NULL);
- if (IS_ERR(sensor->ext_clk)) {
- dev_err(>dev, "could not get clock (%ld)\n",
- PTR_ERR(sensor->ext_clk));
- return -EPROBE_DEFER;
- }
-
- rval = clk_set_rate(sensor->ext_clk,
- sensor->hwcfg->ext_clk);
- if (rval < 0) {
- dev_err(>dev,
- "unable to set clock freq to %u\n",
- sensor->hwcfg->ext_clk);
- return rval;
- }
-
- sensor->xshutdown = devm_gpiod_get_optional(>dev, "xshutdown",
- GPIOD_OUT_LOW);
- if (IS_ERR(sensor->xshutdown))
- return PTR_ERR(sensor->xshutdown);
-
- rval = smiapp_power_on(sensor);
- if (rval)
- return -ENODEV;
-
- rval = smiapp_identify_module(sensor);
- if (rval) {
- rval = -ENODEV;
- goto out_power_off;
- }
-
- rval = smiapp_get_all_limits(sensor);
- if (rval) {
- rval = -ENODEV;
- goto out_power_off;
- }
-
- /*
-* Handle Sensor Module orientation on the board.
-*
-* The application of H-FLIP and V-FLIP on the sensor is modified by
-* the sensor orientation on the board.
-*
-* For SMIAPP_BOARD_SENSOR_ORIENT_180 the default behaviour is to set
-* both H-FLIP and V-FLIP for normal operation which also implies
-* that a set/unset operation for user space HFLIP and VFLIP v4l2
-* controls will need to be internally inverted.
-*
-* Rotation also changes the bayer pattern.
-*/
- if (sensor->hwcfg->module_board_orient ==
- SMIAPP_MODULE_BOARD_ORIENT_180)
- sensor->hvflip_inv_mask = SMIAPP_IMAGE_ORIENTATION_HFLIP |
- SMIAPP_IMAGE_ORIENTATION_VFLIP;
-
- rval = smiapp_call_quirk(sensor, limits);
- if (rval) {
- dev_err(>dev, "limits quirks failed\n");
- goto out_power_off;
- }
-
- if (sensor->limits[SMIAPP_LIMIT_BINNING_CAPABILITY]) {
- u32 val;
-
- rval = smiapp_read(sensor,
- SMIAPP_REG_U8_BINNING_SUBTYPES, );
- if (rval < 0) {
- rval = -ENODEV;
- goto out_power_off;
- }
- sensor->nbinning_subtypes = min_t(u8, val,
- SMIAPP_BINNING_SUBTYPES);
-
- for (i = 0; i < sensor->nbinning_subtypes; i++) {
- rval = smiapp_read(
- sensor, SMIAPP_REG_U8_BINNING_TYPE_n(i), );
- if (rval < 0) {
- rval = -ENODEV;
- goto out_power_off;
- }
- sensor->binning_subtypes[i] =
- *(struct smiapp_binning_subtype *)
-
- dev_dbg(>dev, "binning %xx%x\n",
- sensor->binning_subtypes[i].horizontal,
- sensor->binning_subtypes[i].vertical);
- }
- }
- sensor->binning_horizontal = 1;
- sensor->binning_vertical = 1;
-
- if (device_create_file(>dev, _attr_ident) != 0) {
- dev_err(>dev, "sysfs ident entry creation failed\n");
- rval = -ENOENT;
- goto out_power_off;
- }
- /* SMIA++ NVM initialization - it will be read from the sensor
-* when it is first requested by userspace.
-*/
- if (sensor->minfo.smiapp_version && sensor->hwcfg->nvm_size) {
- sensor->nvm = devm_kzalloc(>dev,
- sensor->hwcfg->nvm_size, GFP_KERNEL);