Re: [v2 2/2] backlight: Add DisplayPort aux backlight driver

From: Daniel Thompson
Date: Mon Apr 26 2021 - 07:11:26 EST


On Sat, Apr 24, 2021 at 03:25:04AM +0530, Rajeev Nandan wrote:
> Add backlight driver for the panels supporting backlight control
> using DPCD registers on the DisplayPort aux channel.
>
> Changes in v2:
> - New (most of the code reused from drm_dp_aux_backlight.c of v1)

Did you respond to Jani's feedback on the v1 posting (asking you to
coordinate with Lyude's work on refactoring the i915 eDP helpers[1])?
I can't find anything showing the outcome of that.

[1]: https://www.spinics.net/lists/dri-devel/msg295602.html


> +static struct drm_dp_aux *i2c_to_aux(struct i2c_adapter *i2c)
> +{
> + return container_of(i2c, struct drm_dp_aux, ddc);
> +}

[...]

> + np = of_parse_phandle(pdev->dev.of_node, "ddc-i2c-bus", 0);
> + if (!np) {
> + dev_err(&pdev->dev, "failed to get aux ddc I2C bus\n");
> + return -ENODEV;
> + }
> +
> + ddc = of_find_i2c_adapter_by_node(np);
> + of_node_put(np);
> + if (!ddc)
> + return -EPROBE_DEFER;
> +
> + aux_bl->aux = i2c_to_aux(ddc);
> + dev_dbg(&pdev->dev, "using dp aux %s\n", aux_bl->aux->name);

It looks like this code "just knows" that the I2C controller it has
looked up is a special one. That seems a little odd to me.

If we "just know" this then I'd hope that is could either be modelled
in the devicetree or that it would be possible for the backlight driver
to be registered (possibly using helpers) by whatever it is that is
setting up struct drm_dp_aux in the first place.


Daniel.