Re: [PATCH v4 4/8] ACPI: property: Generate camera swnodes for ACPI and DisCo for Imaging

Andy Shevchenko
2023-02-08T16:48:33Z

On Wed, Feb 08, 2023 at 05:28:03PM +0200, Sakari Ailus wrote:
> Generate software nodes for information parsed from ACPI _CRS for CSI-2 as
> well as MIPI DisCo for Imaging spec. The software nodes are compliant with
> existing ACPI or DT definitions and are parsed by relevant drivers without
> changes.

...

> + ret = fwnode_property_count_u8(mipi_port_fwnode, "mipi-img-lane-polarities");
> + if (ret > 0) {
> + unsigned int bytes = min_t(unsigned int, ret, sizeof(val));
> +
> + fwnode_property_read_u8_array(mipi_port_fwnode,
> + "mipi-img-lane-polarities",
> + val, bytes);
> +
> + /* Total number of lanes here is clock lane + data lanes */
> + if (bytes * BITS_PER_TYPE(u8) >= 1 + num_lanes) {
> + unsigned int i;
> +
> + /* Move polarity bits to the lane polarity u32 array */
> + for (i = 0; i < 1 + num_lanes; i++)
> + port->lane_polarities[i] =
> + (bool)(val[i >> 3] & (1 << (i & 7)));
> +
> + port->ep_props[NEXT_PROPERTY(*ep_prop_index, EP_LANE_POLARITIES)] =
> + PROPERTY_ENTRY_U32_ARRAY_LEN("lane-polarities",
> + port->lane_polarities,
> + 1 + num_lanes);
> + } else {
> + acpi_handle_warn(acpi_device_handle(device),
> + "too few lane polarity bytes (%u)\n",
> + bytes);
> + }
> + }

I still think this will be better with bitmap APIs in use, but I leave it to
maintainers and you to decide.

--
With Best Regards,
Andy Shevchenko