Lines Matching full:sensor

45  * Do not add an entry for a sensor that is not actually supported.
132 /* camera sensor depends on IVSC in DSDT if exist */ in ipu_bridge_get_ivsc_acpi_dev()
182 static int ipu_bridge_check_ivsc_dev(struct ipu_sensor *sensor, in ipu_bridge_check_ivsc_dev() argument
197 sensor->csi_dev = csi_dev; in ipu_bridge_check_ivsc_dev()
198 sensor->ivsc_adev = adev; in ipu_bridge_check_ivsc_dev()
296 int ipu_bridge_parse_ssdb(struct acpi_device *adev, struct ipu_sensor *sensor) in ipu_bridge_parse_ssdb() argument
315 sensor->link = ssdb.link; in ipu_bridge_parse_ssdb()
316 sensor->lanes = ssdb.lanes; in ipu_bridge_parse_ssdb()
317 sensor->mclkspeed = ssdb.mclkspeed; in ipu_bridge_parse_ssdb()
318 sensor->rotation = ipu_bridge_parse_rotation(adev, &ssdb); in ipu_bridge_parse_ssdb()
319 sensor->orientation = ipu_bridge_parse_orientation(adev); in ipu_bridge_parse_ssdb()
322 sensor->vcm_type = ipu_vcm_types[ssdb.vcmtype - 1]; in ipu_bridge_parse_ssdb()
329 struct ipu_sensor *sensor, in ipu_bridge_create_fwnode_properties() argument
333 struct ipu_property_names *names = &sensor->prop_names; in ipu_bridge_create_fwnode_properties()
334 struct software_node *nodes = sensor->swnodes; in ipu_bridge_create_fwnode_properties()
336 sensor->prop_names = prop_names; in ipu_bridge_create_fwnode_properties()
338 if (sensor->csi_dev) { in ipu_bridge_create_fwnode_properties()
339 sensor->local_ref[0] = in ipu_bridge_create_fwnode_properties()
341 sensor->remote_ref[0] = in ipu_bridge_create_fwnode_properties()
343 sensor->ivsc_sensor_ref[0] = in ipu_bridge_create_fwnode_properties()
345 sensor->ivsc_ipu_ref[0] = in ipu_bridge_create_fwnode_properties()
348 sensor->ivsc_sensor_ep_properties[0] = in ipu_bridge_create_fwnode_properties()
351 sensor->ivsc_sensor_ep_properties[1] = in ipu_bridge_create_fwnode_properties()
354 sensor->lanes); in ipu_bridge_create_fwnode_properties()
355 sensor->ivsc_sensor_ep_properties[2] = in ipu_bridge_create_fwnode_properties()
357 sensor->ivsc_sensor_ref); in ipu_bridge_create_fwnode_properties()
359 sensor->ivsc_ipu_ep_properties[0] = in ipu_bridge_create_fwnode_properties()
362 sensor->ivsc_ipu_ep_properties[1] = in ipu_bridge_create_fwnode_properties()
365 sensor->lanes); in ipu_bridge_create_fwnode_properties()
366 sensor->ivsc_ipu_ep_properties[2] = in ipu_bridge_create_fwnode_properties()
368 sensor->ivsc_ipu_ref); in ipu_bridge_create_fwnode_properties()
370 sensor->local_ref[0] = in ipu_bridge_create_fwnode_properties()
372 sensor->remote_ref[0] = in ipu_bridge_create_fwnode_properties()
376 sensor->dev_properties[0] = PROPERTY_ENTRY_U32( in ipu_bridge_create_fwnode_properties()
377 sensor->prop_names.clock_frequency, in ipu_bridge_create_fwnode_properties()
378 sensor->mclkspeed); in ipu_bridge_create_fwnode_properties()
379 sensor->dev_properties[1] = PROPERTY_ENTRY_U32( in ipu_bridge_create_fwnode_properties()
380 sensor->prop_names.rotation, in ipu_bridge_create_fwnode_properties()
381 sensor->rotation); in ipu_bridge_create_fwnode_properties()
382 sensor->dev_properties[2] = PROPERTY_ENTRY_U32( in ipu_bridge_create_fwnode_properties()
383 sensor->prop_names.orientation, in ipu_bridge_create_fwnode_properties()
384 sensor->orientation); in ipu_bridge_create_fwnode_properties()
385 if (sensor->vcm_type) { in ipu_bridge_create_fwnode_properties()
386 sensor->vcm_ref[0] = in ipu_bridge_create_fwnode_properties()
387 SOFTWARE_NODE_REFERENCE(&sensor->swnodes[SWNODE_VCM]); in ipu_bridge_create_fwnode_properties()
388 sensor->dev_properties[3] = in ipu_bridge_create_fwnode_properties()
389 PROPERTY_ENTRY_REF_ARRAY("lens-focus", sensor->vcm_ref); in ipu_bridge_create_fwnode_properties()
392 sensor->ep_properties[0] = PROPERTY_ENTRY_U32( in ipu_bridge_create_fwnode_properties()
393 sensor->prop_names.bus_type, in ipu_bridge_create_fwnode_properties()
395 sensor->ep_properties[1] = PROPERTY_ENTRY_U32_ARRAY_LEN( in ipu_bridge_create_fwnode_properties()
396 sensor->prop_names.data_lanes, in ipu_bridge_create_fwnode_properties()
397 bridge->data_lanes, sensor->lanes); in ipu_bridge_create_fwnode_properties()
398 sensor->ep_properties[2] = PROPERTY_ENTRY_REF_ARRAY( in ipu_bridge_create_fwnode_properties()
399 sensor->prop_names.remote_endpoint, in ipu_bridge_create_fwnode_properties()
400 sensor->local_ref); in ipu_bridge_create_fwnode_properties()
403 sensor->ep_properties[3] = PROPERTY_ENTRY_U64_ARRAY_LEN( in ipu_bridge_create_fwnode_properties()
404 sensor->prop_names.link_frequencies, in ipu_bridge_create_fwnode_properties()
408 sensor->ipu_properties[0] = PROPERTY_ENTRY_U32_ARRAY_LEN( in ipu_bridge_create_fwnode_properties()
409 sensor->prop_names.data_lanes, in ipu_bridge_create_fwnode_properties()
410 bridge->data_lanes, sensor->lanes); in ipu_bridge_create_fwnode_properties()
411 sensor->ipu_properties[1] = PROPERTY_ENTRY_REF_ARRAY( in ipu_bridge_create_fwnode_properties()
412 sensor->prop_names.remote_endpoint, in ipu_bridge_create_fwnode_properties()
413 sensor->remote_ref); in ipu_bridge_create_fwnode_properties()
416 static void ipu_bridge_init_swnode_names(struct ipu_sensor *sensor) in ipu_bridge_init_swnode_names() argument
418 snprintf(sensor->node_names.remote_port, in ipu_bridge_init_swnode_names()
419 sizeof(sensor->node_names.remote_port), in ipu_bridge_init_swnode_names()
420 SWNODE_GRAPH_PORT_NAME_FMT, sensor->link); in ipu_bridge_init_swnode_names()
421 snprintf(sensor->node_names.port, in ipu_bridge_init_swnode_names()
422 sizeof(sensor->node_names.port), in ipu_bridge_init_swnode_names()
424 snprintf(sensor->node_names.endpoint, in ipu_bridge_init_swnode_names()
425 sizeof(sensor->node_names.endpoint), in ipu_bridge_init_swnode_names()
427 if (sensor->vcm_type) { in ipu_bridge_init_swnode_names()
429 snprintf(sensor->node_names.vcm, sizeof(sensor->node_names.vcm), in ipu_bridge_init_swnode_names()
430 "%s-%u", sensor->vcm_type, sensor->link); in ipu_bridge_init_swnode_names()
433 if (sensor->csi_dev) { in ipu_bridge_init_swnode_names()
434 snprintf(sensor->node_names.ivsc_sensor_port, in ipu_bridge_init_swnode_names()
435 sizeof(sensor->node_names.ivsc_sensor_port), in ipu_bridge_init_swnode_names()
437 snprintf(sensor->node_names.ivsc_ipu_port, in ipu_bridge_init_swnode_names()
438 sizeof(sensor->node_names.ivsc_ipu_port), in ipu_bridge_init_swnode_names()
443 static void ipu_bridge_init_swnode_group(struct ipu_sensor *sensor) in ipu_bridge_init_swnode_group() argument
445 struct software_node *nodes = sensor->swnodes; in ipu_bridge_init_swnode_group()
447 sensor->group[SWNODE_SENSOR_HID] = &nodes[SWNODE_SENSOR_HID]; in ipu_bridge_init_swnode_group()
448 sensor->group[SWNODE_SENSOR_PORT] = &nodes[SWNODE_SENSOR_PORT]; in ipu_bridge_init_swnode_group()
449 sensor->group[SWNODE_SENSOR_ENDPOINT] = &nodes[SWNODE_SENSOR_ENDPOINT]; in ipu_bridge_init_swnode_group()
450 sensor->group[SWNODE_IPU_PORT] = &nodes[SWNODE_IPU_PORT]; in ipu_bridge_init_swnode_group()
451 sensor->group[SWNODE_IPU_ENDPOINT] = &nodes[SWNODE_IPU_ENDPOINT]; in ipu_bridge_init_swnode_group()
452 if (sensor->vcm_type) in ipu_bridge_init_swnode_group()
453 sensor->group[SWNODE_VCM] = &nodes[SWNODE_VCM]; in ipu_bridge_init_swnode_group()
455 if (sensor->csi_dev) { in ipu_bridge_init_swnode_group()
456 sensor->group[SWNODE_IVSC_HID] = in ipu_bridge_init_swnode_group()
458 sensor->group[SWNODE_IVSC_SENSOR_PORT] = in ipu_bridge_init_swnode_group()
460 sensor->group[SWNODE_IVSC_SENSOR_ENDPOINT] = in ipu_bridge_init_swnode_group()
462 sensor->group[SWNODE_IVSC_IPU_PORT] = in ipu_bridge_init_swnode_group()
464 sensor->group[SWNODE_IVSC_IPU_ENDPOINT] = in ipu_bridge_init_swnode_group()
467 if (sensor->vcm_type) in ipu_bridge_init_swnode_group()
468 sensor->group[SWNODE_VCM] = &nodes[SWNODE_VCM]; in ipu_bridge_init_swnode_group()
470 if (sensor->vcm_type) in ipu_bridge_init_swnode_group()
471 sensor->group[SWNODE_IVSC_HID] = &nodes[SWNODE_VCM]; in ipu_bridge_init_swnode_group()
476 struct ipu_sensor *sensor) in ipu_bridge_create_connection_swnodes() argument
478 struct ipu_node_names *names = &sensor->node_names; in ipu_bridge_create_connection_swnodes()
479 struct software_node *nodes = sensor->swnodes; in ipu_bridge_create_connection_swnodes()
481 ipu_bridge_init_swnode_names(sensor); in ipu_bridge_create_connection_swnodes()
483 nodes[SWNODE_SENSOR_HID] = NODE_SENSOR(sensor->name, in ipu_bridge_create_connection_swnodes()
484 sensor->dev_properties); in ipu_bridge_create_connection_swnodes()
485 nodes[SWNODE_SENSOR_PORT] = NODE_PORT(sensor->node_names.port, in ipu_bridge_create_connection_swnodes()
488 sensor->node_names.endpoint, in ipu_bridge_create_connection_swnodes()
490 sensor->ep_properties); in ipu_bridge_create_connection_swnodes()
491 nodes[SWNODE_IPU_PORT] = NODE_PORT(sensor->node_names.remote_port, in ipu_bridge_create_connection_swnodes()
494 sensor->node_names.endpoint, in ipu_bridge_create_connection_swnodes()
496 sensor->ipu_properties); in ipu_bridge_create_connection_swnodes()
498 if (sensor->csi_dev) { in ipu_bridge_create_connection_swnodes()
502 device_hid = acpi_device_hid(sensor->ivsc_adev); in ipu_bridge_create_connection_swnodes()
505 snprintf(sensor->ivsc_name, sizeof(sensor->ivsc_name), "%s-%u", in ipu_bridge_create_connection_swnodes()
506 device_hid, sensor->link); in ipu_bridge_create_connection_swnodes()
508 nodes[SWNODE_IVSC_HID] = NODE_SENSOR(sensor->ivsc_name, in ipu_bridge_create_connection_swnodes()
509 sensor->ivsc_properties); in ipu_bridge_create_connection_swnodes()
516 sensor->ivsc_sensor_ep_properties); in ipu_bridge_create_connection_swnodes()
523 sensor->ivsc_ipu_ep_properties); in ipu_bridge_create_connection_swnodes()
526 nodes[SWNODE_VCM] = NODE_VCM(sensor->node_names.vcm); in ipu_bridge_create_connection_swnodes()
528 ipu_bridge_init_swnode_group(sensor); in ipu_bridge_create_connection_swnodes()
537 struct device *sensor; member
547 struct acpi_device *adev = ACPI_COMPANION(data->sensor); in ipu_bridge_instantiate_vcm_work()
554 * make sure the sensor is powered-up during probe. in ipu_bridge_instantiate_vcm_work()
556 ret = pm_runtime_get_sync(data->sensor); in ipu_bridge_instantiate_vcm_work()
558 dev_err(data->sensor, "Error %d runtime-resuming sensor, cannot instantiate VCM\n", in ipu_bridge_instantiate_vcm_work()
570 dev_err(data->sensor, "Error instantiating VCM client: %ld\n", in ipu_bridge_instantiate_vcm_work()
575 device_link_add(&vcm_client->dev, data->sensor, DL_FLAG_PM_RUNTIME); in ipu_bridge_instantiate_vcm_work()
577 dev_info(data->sensor, "Instantiated %s VCM\n", data->board_info.type); in ipu_bridge_instantiate_vcm_work()
581 pm_runtime_put(data->sensor); in ipu_bridge_instantiate_vcm_work()
582 put_device(data->sensor); in ipu_bridge_instantiate_vcm_work()
588 int ipu_bridge_instantiate_vcm(struct device *sensor) in ipu_bridge_instantiate_vcm() argument
596 adev = ACPI_COMPANION(sensor); in ipu_bridge_instantiate_vcm()
600 vcm_fwnode = fwnode_find_reference(dev_fwnode(sensor), "lens-focus", 0); in ipu_bridge_instantiate_vcm()
619 data->sensor = get_device(sensor); in ipu_bridge_instantiate_vcm()
636 static int ipu_bridge_instantiate_ivsc(struct ipu_sensor *sensor) in ipu_bridge_instantiate_ivsc() argument
640 if (!sensor->csi_dev) in ipu_bridge_instantiate_ivsc()
643 fwnode = software_node_fwnode(&sensor->swnodes[SWNODE_IVSC_HID]); in ipu_bridge_instantiate_ivsc()
647 set_secondary_fwnode(sensor->csi_dev, fwnode); in ipu_bridge_instantiate_ivsc()
654 struct ipu_sensor *sensor; in ipu_bridge_unregister_sensors() local
658 sensor = &bridge->sensors[i]; in ipu_bridge_unregister_sensors()
659 software_node_unregister_node_group(sensor->group); in ipu_bridge_unregister_sensors()
660 acpi_dev_put(sensor->adev); in ipu_bridge_unregister_sensors()
661 put_device(sensor->csi_dev); in ipu_bridge_unregister_sensors()
662 acpi_dev_put(sensor->ivsc_adev); in ipu_bridge_unregister_sensors()
670 struct ipu_sensor *sensor; local
688 sensor = &bridge->sensors[bridge->n_sensors];
690 ret = bridge->parse_sensor_fwnode(adev, sensor);
694 snprintf(sensor->name, sizeof(sensor->name), "%s-%u",
695 cfg->hid, sensor->link);
697 ret = ipu_bridge_check_ivsc_dev(sensor, adev);
701 ipu_bridge_create_fwnode_properties(sensor, bridge, cfg);
702 ipu_bridge_create_connection_swnodes(bridge, sensor);
704 ret = software_node_register_node_group(sensor->group);
708 fwnode = software_node_fwnode(&sensor->swnodes[
715 sensor->adev = ACPI_PTR(acpi_dev_get(adev));
720 ret = ipu_bridge_instantiate_ivsc(sensor);
724 dev_info(bridge->dev, "Found supported sensor %s\n",
733 software_node_unregister_node_group(sensor->group);
735 put_device(sensor->csi_dev);
736 acpi_dev_put(sensor->ivsc_adev);
851 * only need one, rather than one per sensor). We include it as a