src/devices/board/drivers/sherlock/sherlock-camera.cc
// Refer to camera design document for driver
// design and layout details.
Refer to camera design document for driver
design and layout details.
Refer to camera design document for driver design and layout details .
zx_status_t Sherlock::CameraInit() {
  gpio_impl_.SetAltFunction(T931_GPIOAO(10), kClk24MAltFunc);
  gpio_impl_.SetDriveStrength(T931_GPIOAO(10), kClkGpioDriveStrengthUa, nullptr);
  zx_status_t status = pbus_.DeviceAdd(&mipi_dev);
  if (status != ZX_OK) {
    zxlogf(ERROR, "%s: Mipi_Device DeviceAdd failed %d", __func__, status);
    return status;
  }
  if (pid_ == PDEV_PID_LUIS) {
    status = pbus_.CompositeDeviceAdd(&sensor_dev_luis, imx355_sensor_fragments,
                                      countof(imx355_sensor_fragments), 1);
  } else {
    status = pbus_.CompositeDeviceAdd(&sensor_dev_sherlock, imx227_sensor_fragments,
                                      countof(imx227_sensor_fragments), 1);
  }
  if (status != ZX_OK) {
    zxlogf(ERROR, "%s: Camera Sensor DeviceAdd failed %d", __func__, status);
    return status;
  }
  status = pbus_.CompositeDeviceAdd(&gdc_dev, gdc_fragments, countof(gdc_fragments), 1);
  if (status != ZX_OK) {
    zxlogf(ERROR, "%s: GDC DeviceAdd failed %d", __func__, status);
    return status;
  }
  status = pbus_.CompositeDeviceAdd(&ge2d_dev, ge2d_fragments, countof(ge2d_fragments), 1);
  if (status != ZX_OK) {
    zxlogf(ERROR, "%s: GE2D DeviceAdd failed %d", __func__, status);
    return status;
  }
  status = pbus_.CompositeDeviceAdd(&isp_dev, isp_fragments, countof(isp_fragments), 1);
  if (status != ZX_OK) {
    zxlogf(ERROR, "%s: ISP DeviceAdd failed %d", __func__, status);
    return status;
  }
  constexpr zx_device_prop_t camera_controller_props[] = {
      {BIND_PLATFORM_DEV_DID, 0, PDEV_DID_CAMERA_CONTROLLER},
  };
  const composite_device_desc_t camera_comp_desc = {
      .props = camera_controller_props,
      .props_count = countof(camera_controller_props),
      .fragments = camera_controller_fragments,
      .fragments_count = countof(camera_controller_fragments),
      .coresident_device_index = 0,
      .metadata_list = nullptr,
      .metadata_count = 0,
  };
  status = DdkAddComposite("camera-controller", &camera_comp_desc);
  if (status != ZX_OK) {
    zxlogf(ERROR, "%s: Camera Controller DeviceAdd failed %d", __func__, status);
    return status;
  }
  return status;
}
zx_status_t Sherlock :: CameraInit ( ) { gpio_impl_ . SetAltFunction ( T931_GPIOAO ( 10 ) , kClk24MAltFunc ) ; gpio_impl_ . SetDriveStrength ( T931_GPIOAO ( 10 ) , kClkGpioDriveStrengthUa , nullptr ) ; zx_status_t status = pbus_ . DeviceAdd ( & mipi_dev ) ; if ( status != ZX_OK ) { zxlogf ( ERROR , " " , __func__ , status ) ; return status ; } if ( pid_ == PDEV_PID_LUIS ) { status = pbus_ . CompositeDeviceAdd ( & sensor_dev_luis , imx355_sensor_fragments , countof ( imx355_sensor_fragments ) , 1 ) ; } else { status = pbus_ . CompositeDeviceAdd ( & sensor_dev_sherlock , imx227_sensor_fragments , countof ( imx227_sensor_fragments ) , 1 ) ; } if ( status != ZX_OK ) { zxlogf ( ERROR , " " , __func__ , status ) ; return status ; } status = pbus_ . CompositeDeviceAdd ( & gdc_dev , gdc_fragments , countof ( gdc_fragments ) , 1 ) ; if ( status != ZX_OK ) { zxlogf ( ERROR , " " , __func__ , status ) ; return status ; } status = pbus_ . CompositeDeviceAdd ( & ge2d_dev , ge2d_fragments , countof ( ge2d_fragments ) , 1 ) ; if ( status != ZX_OK ) { zxlogf ( ERROR , " " , __func__ , status ) ; return status ; } status = pbus_ . CompositeDeviceAdd ( & isp_dev , isp_fragments , countof ( isp_fragments ) , 1 ) ; if ( status != ZX_OK ) { zxlogf ( ERROR , " " , __func__ , status ) ; return status ; } constexpr zx_device_prop_t camera_controller_props [ ] = { { BIND_PLATFORM_DEV_DID , 0 , PDEV_DID_CAMERA_CONTROLLER } , } ; const composite_device_desc_t camera_comp_desc = { . props = camera_controller_props , . props_count = countof ( camera_controller_props ) , . fragments = camera_controller_fragments , . fragments_count = countof ( camera_controller_fragments ) , . coresident_device_index = 0 , . metadata_list = nullptr , . metadata_count = 0 , } ; status = DdkAddComposite ( " " , & camera_comp_desc ) ; if ( status != ZX_OK ) { zxlogf ( ERROR , " " , __func__ , status ) ; return status ; } return status ; }
Refer to camera design document for driver
design and layout details.
Refer to camera design document for driver design and layout details .
// Set GPIO alternate functions. // Add a composite device for ARM ISP