Hi Bingbu, On Mon, Oct 30, 2023 at 04:30:39PM +0800, Bingbu Cao wrote: > > +static void intel_cio2_bridge_instantiate_vcm_work(struct work_struct *_work) > > +{ > > + struct intel_cio2_bridge_instantiate_vcm_work_data *work = > > + container_of(_work, > > + struct intel_cio2_bridge_instantiate_vcm_work_data, > > + work); > > + struct acpi_device *adev = ACPI_COMPANION(work->sensor); > > + struct i2c_client *vcm_client; > > + bool put_fwnode = true; > > + int ret; > > > > - snprintf(name, sizeof(name), "%s-VCM", acpi_dev_name(sensor->adev)); > > - board_info.dev_name = name; > > - strscpy(board_info.type, sensor->vcm_type, ARRAY_SIZE(board_info.type)); > > - board_info.swnode = &sensor->swnodes[SWNODE_VCM]; > > - > > - sensor->vcm_i2c_client = > > - i2c_acpi_new_device_by_fwnode(acpi_fwnode_handle(sensor->adev), > > - 1, &board_info); > > - if (IS_ERR(sensor->vcm_i2c_client)) { > > - dev_warn(&sensor->adev->dev, "Error instantiation VCM i2c-client: %ld\n", > > - PTR_ERR(sensor->vcm_i2c_client)); > > - sensor->vcm_i2c_client = NULL; > > + /* > > + * The client may get probed before the device_link gets added below > > + * make sure the sensor is powered-up during probe. > > + */ > > + ret = pm_runtime_get_sync(work->sensor); > > + if (ret < 0) { > > + dev_err(work->sensor, "Error %d runtime-resuming sensor, cannot instantiate VCM\n", > > + ret); > > + goto out; > > } > > One question here: how do we make sure that the runtime PM of the sensor > is enabled during the .bound callback? Or is it a mandatory requirement > of driver of such camera sensors? The sensor driver needs to enable runtime PM in probe, otherwise this won't work. But I don't see why a driver wouldn't? Of course otherwise it wouldn't be a hard requirement. This function gets called after the upstream notifier (CIO2 in this case) driver's bound is called, the sensor's probe function has been run by this time so this part should be fine. -- Regards, Sakari Ailus