On Fri, Jun 30, 2023 at 2:07 PM Hans de Goede <hdegoede@xxxxxxxxxx> wrote: > > In most cases when a VCM is used there is a single integrated module > with the sensor + VCM + lens. This means that the sensor and VCM often > share regulators and possibly also something like a powerdown pin. > > In the ACPI tables this is modelled as a single ACPI device with > multiple I2cSerialBus resources. > > On atomisp devices the regulators and clks are modelled as ACPI > power-resources, which are controlled by the (ACPI) power state > of the sensor. So the sensor must be in D0 power state for the VCM > to work. > > To make this work add a device-link with DL_FLAG_PM_RUNTIME flag > so that the sensor will automatically be runtime-resumed whenever > the VCM is runtime-resumed. > > This requires the probing of the VCM and thus the creation of the VCM > I2C-client to be delayed till after the sensor driver has bound. > > Move the instantiation of the VCM I2C-client to the v4l2_async_notifier > bound op, so that it is done after the sensor driver has bound; and > add code to add the device-link. > > This fixes the problem with the shared ACPI power-resources on atomisp2 > and this avoids the need for VCM related workarounds on IPU3 / IPU6. > > E.g. until now the dw9719 driver needed to get and control a Vsio > (V sensor IO) regulator since that needs to be enabled to enable I2C > pass-through on the PMIC on the sensor module. So the driver was > controlling this regulator even though the actual dw9719 chip has no > Vsio pin / power-plane. > > This also removes the need for ipu_bridge_init() to return > -EPROBE_DEFER since the VCM is now instantiated later. ... > +static void ipu_bridge_instantiate_vcm_work(struct work_struct *_work) > +{ > + struct ipu_bridge_instantiate_vcm_work_data *work = > + container_of(_work, > + struct ipu_bridge_instantiate_vcm_work_data, > + work); Just noticed this plenty of *work. Perhaps call the parameter work and the stack variable wdata or so? > } -- With Best Regards, Andy Shevchenko