Commit 1d6e5c30 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

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: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 95d1f398
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
# #
obj-$(CONFIG_INTEL_ATOMISP) += i2c/ obj-$(CONFIG_INTEL_ATOMISP) += i2c/
obj-$(CONFIG_VIDEO_ATOMISP) += atomisp.o obj-$(CONFIG_VIDEO_ATOMISP) += atomisp.o
obj-$(CONFIG_VIDEO_ATOMISP) += pci/atomisp_gmin_platform.o
# While on staging, keep debug enabled # While on staging, keep debug enabled
DEFINES += -DDEBUG DEFINES += -DDEBUG
...@@ -23,7 +24,6 @@ atomisp-objs += \ ...@@ -23,7 +24,6 @@ atomisp-objs += \
pci/atomisp_subdev.o \ pci/atomisp_subdev.o \
pci/atomisp_tpg.o \ pci/atomisp_tpg.o \
pci/atomisp_v4l2.o \ pci/atomisp_v4l2.o \
pci/atomisp_gmin_platform.o \
pci/sh_css_firmware.o \ pci/sh_css_firmware.o \
pci/sh_css_host_data.o \ pci/sh_css_host_data.o \
pci/sh_css_hrt.o \ pci/sh_css_hrt.o \
......
...@@ -1076,3 +1076,6 @@ static void isp_pm_cap_fixup(struct pci_dev *dev) ...@@ -1076,3 +1076,6 @@ static void isp_pm_cap_fixup(struct pci_dev *dev)
dev->pm_cap = 0; dev->pm_cap = 0;
} }
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0f38, isp_pm_cap_fixup); DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0f38, isp_pm_cap_fixup);
MODULE_DESCRIPTION("Ancillary routines for binding ACPI devices");
MODULE_LICENSE("GPL");
...@@ -1083,6 +1083,22 @@ static int atomisp_subdev_probe(struct atomisp_device *isp) ...@@ -1083,6 +1083,22 @@ static int atomisp_subdev_probe(struct atomisp_device *isp)
return 0; 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 */ /* FIXME: should, instead, use I2C probe */
for (subdevs = pdata->subdevs; subdevs->type; ++subdevs) { for (subdevs = pdata->subdevs; subdevs->type; ++subdevs) {
...@@ -1192,16 +1208,6 @@ static int atomisp_subdev_probe(struct atomisp_device *isp) ...@@ -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 * HACK: Currently VCM belongs to primary sensor only, but correct
* approach must be to acquire from platform code which sensor * approach must be to acquire from platform code which sensor
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment