media: atomisp: change the code to properly wait for sensor

The sensor should finish its init before atomisp driver, as
otherwise the atomisp driver won't be able to talk with it.

So, we need to turn atomisp_gmin_platform into a module
again, for it to not depend on atomisp driver to finish
probing, and add some delay at atomisp to let the sensor
driver to finish probing.

Yeah, this is hacky. The real solution here would be to use
the async framework, but for now, our goal is to make the
driver to work. So, let's postpone such change to be done
later.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
Mauro Carvalho Chehab 2020-05-19 10:35:38 +02:00
parent 95d1f398c4
commit 1d6e5c3040
3 changed files with 20 additions and 11 deletions

View File

@ -3,6 +3,7 @@
#
obj-$(CONFIG_INTEL_ATOMISP) += i2c/
obj-$(CONFIG_VIDEO_ATOMISP) += atomisp.o
obj-$(CONFIG_VIDEO_ATOMISP) += pci/atomisp_gmin_platform.o
# While on staging, keep debug enabled
DEFINES += -DDEBUG
@ -23,7 +24,6 @@ atomisp-objs += \
pci/atomisp_subdev.o \
pci/atomisp_tpg.o \
pci/atomisp_v4l2.o \
pci/atomisp_gmin_platform.o \
pci/sh_css_firmware.o \
pci/sh_css_host_data.o \
pci/sh_css_hrt.o \

View File

@ -1076,3 +1076,6 @@ static void isp_pm_cap_fixup(struct pci_dev *dev)
dev->pm_cap = 0;
}
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0f38, isp_pm_cap_fixup);
MODULE_DESCRIPTION("Ancillary routines for binding ACPI devices");
MODULE_LICENSE("GPL");

View File

@ -1083,6 +1083,22 @@ static int atomisp_subdev_probe(struct atomisp_device *isp)
return 0;
}
/* FIXME: should return -EPROBE_DEFER if not all subdevs were probed */
for (count = 0; count < SUBDEV_WAIT_TIMEOUT_MAX_COUNT; count++) {
int camera_count = 0;
for (subdevs = pdata->subdevs; subdevs->type; ++subdevs) {
if (subdevs->type == RAW_CAMERA ||
subdevs->type == SOC_CAMERA)
camera_count ++;
}
if (camera_count)
break;
msleep(SUBDEV_WAIT_TIMEOUT);
count++;
}
/* Wait more time to give more time for subdev init code to finish */
msleep(5 * SUBDEV_WAIT_TIMEOUT);
/* FIXME: should, instead, use I2C probe */
for (subdevs = pdata->subdevs; subdevs->type; ++subdevs) {
@ -1192,16 +1208,6 @@ static int atomisp_subdev_probe(struct atomisp_device *isp)
}
}
/* FIXME: should return -EPROBE_DEFER if not all subdevs were probed */
for (count = 0; count < SUBDEV_WAIT_TIMEOUT_MAX_COUNT; count++) {
if (isp->input_cnt)
break;
msleep(SUBDEV_WAIT_TIMEOUT);
count++;
}
/* Wait more time to give more time for subdev init code */
msleep(5 * SUBDEV_WAIT_TIMEOUT);
/*
* HACK: Currently VCM belongs to primary sensor only, but correct
* approach must be to acquire from platform code which sensor