Re: [PATCH 3/5] gpio: tps68470: Add support for the indicator LED outputs

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

 



On Mon, Nov 28, 2022 at 11:44 PM Hans de Goede <hdegoede@xxxxxxxxxx> wrote:
>
> The tps68470 has support for 2 indicator LED outputs called
> ileda and iledb, at support for these as GPIO pins 10 + 11.

add ?

...

> +static void tps68470_gpio_get_reg_and_mask(bool get, unsigned int offset,
> +                                          unsigned int *reg, int *mask)

Hmm... Usual way is to put the get/set flag at the end of the list of
parameters.
Also why not naming it as 'dir' to avoid confusion with the _get in
the function name?

> +{
> +       if (offset < TPS68470_N_REGULAR_GPIO) {
> +               if (get)
> +                       *reg = TPS68470_REG_GPDI;
> +               else
> +                       *reg = TPS68470_REG_GPDO;
> +               *mask = BIT(offset);
> +       } else if (offset < (TPS68470_N_REGULAR_GPIO + TPS68470_N_LOGIC_OUTPUT)) {
> +               *reg = TPS68470_REG_SGPO;
> +               *mask = BIT(offset - TPS68470_N_REGULAR_GPIO);
> +       } else {
> +               *reg = TPS68470_REG_ILEDCTL;
> +               if (offset == (TPS68470_N_REGULAR_GPIO + TPS68470_N_LOGIC_OUTPUT))
> +                       *mask = TPS68470_ILEDCTL_ENA;
> +               else
> +                       *mask = TPS68470_ILEDCTL_ENB;
> +       }
> +}

-- 
With Best Regards,
Andy Shevchenko



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux