Re: [PATCH v9 2/4] media: i2c: Add MAX9286 driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Kieran,

On Thu, May 14, 2020 at 1:47 PM Kieran Bingham
<kieran.bingham+renesas@xxxxxxxxxxxxxxxx> wrote:
> On 14/05/2020 11:13, Manivannan Sadhasivam wrote:
> > On Thu, May 14, 2020 at 11:02:53AM +0100, Kieran Bingham wrote:
> >> On 12/05/2020 19:17, Manivannan Sadhasivam wrote:
> >>> On Tue, May 12, 2020 at 04:51:03PM +0100, Kieran Bingham wrote:
> >>>> The MAX9286 is a 4-channel GMSL deserializer with coax or STP input and
> >>>> CSI-2 output. The device supports multicamera streaming applications,
> >>>> and features the ability to synchronise the attached cameras.
> >>>>
> >>>> CSI-2 output can be configured with 1 to 4 lanes, and a control channel
> >>>> is supported over I2C, which implements an I2C mux to facilitate
> >>>> communications with connected cameras across the reverse control
> >>>> channel.
> >>>>
> >>>> Signed-off-by: Jacopo Mondi <jacopo+renesas@xxxxxxxxxx>
> >>>> Signed-off-by: Kieran Bingham <kieran.bingham+renesas@xxxxxxxxxxxxxxxx>
> >>>> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@xxxxxxxxxxxxxxxx>
> >>>> Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@xxxxxxxxxxxx>

> >>>> --- /dev/null
> >>>> +++ b/drivers/media/i2c/max9286.c

> >>>> +static int max9286_register_gpio(struct max9286_priv *priv)
> >>>> +{
> >>>> +  struct device *dev = &priv->client->dev;
> >>>> +  struct gpio_chip *gpio = &priv->gpio;
> >>>> +  int ret;
> >>>> +
> >>>> +  static const char * const names[] = {
> >>>> +          "GPIO0OUT",
> >>>> +          "GPIO1OUT",
> >>>> +  };
> >>>> +
> >>>> +  /* Configure the GPIO */
> >>>> +  gpio->label = dev_name(dev);
> >>>
> >>> So if you have more than one MAX9286 in a system, all gpiochips will appear
> >>> with the same name. I'd recommend to append the index to distinguish properly.
> >>
> >> Ah yes, that's a good point, and I think I've even seen that.
> >>
> >> I'll fix it now.
>
> Oh, in fact actually this doesn't.
>
> gpiodetect prints:
>
> gpiochip10 [4-004c] (2 lines)
> gpiochip11 [4-006c] (2 lines)
>
> and mostly references them as gpiochip10 and gpiochip11.

Indeed, dev_name() should be different for each instance.

> However,
>
> > [    2.318533] gpio gpiochip11: Detected name collision for GPIO name 'GPIO0OUT'
> > [    2.325739] gpio gpiochip11: Detected name collision for GPIO name 'GPIO1OUT'
>
> That seems to be more of a problem for the gpio library, so I think I'll
> just drop the const names. I don't think they add much value.

These are the line names.  If they're not unique, a warning is printed,
but they are still registered.
So probably you want to use kasprintf("%s.%s", dev_name(dev), names[i]) to
generate names.

See "[PATCH] gpiolib: Document that GPIO line names are not globally unique"
(https://lore.kernel.org/linux-gpio/20200511101828.30046-1-geert+renesas@xxxxxxxxx/)
to clear up the details.

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux