lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <6cec4ed5-3a4a-62d8-5209-da3b0863dcd1@linux.intel.com>
Date:   Thu, 28 May 2020 13:15:45 -0500
From:   Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>
To:     Michael Walle <michael@...le.cc>
Cc:     linux-kernel@...r.kernel.org, linux-gpio@...r.kernel.org,
        Linus Walleij <linus.walleij@...aro.org>,
        Bartosz Golaszewski <bgolaszewski@...libre.com>,
        Mark Brown <broonie@...nel.org>,
        Andy Shevchenko <andy.shevchenko@...il.com>
Subject: Re: [PATCH v6 2/3] gpio: add a reusable generic gpio_chip using
 regmap



>>> +    /* if we have a direction register we need both input and
>>> output */
>>> +    if ((config->reg_dir_out_base || config->reg_dir_in_base) &&
>>> +        (!config->reg_dat_base || !config->reg_set_base))
>>> +        return ERR_PTR(-EINVAL);
>>  This failed for me since I didn't have the 'dat' base assigned. I
>> still can't figure out what 'dat' stands for...I just assigned it to
>> the same offset as the 'set' base but really don't understand what
>> this is supposed to do.
> 
> DAT is the data register, aka input register, if the GPIO is in input
> mode.
> 
> If I read the datasheet correctly you should use the following:
> 
> PCM512x_GPIO_EN should be reg_dir_out_base
> PCM512x_GPIO_CONTROL_1 should be reg_set_base
> PCM512x_GPIN should be reg_dat_base
> 
> no custom xlate necessary. GPIN looks a bit fishy in that datasheet:
>   http://www.ti.com/lit/ds/symlink/pcm5121.pdf?ts=1590684141147

ok, I updated that part - can't test it though with the boards I have, 
only output is supported.

> PCM512x_GPIO_OUTPUT_1..6 is pinmux control and shouldn't be part of
> the gpio-regmap. Your driver needs to take care of that.

yes, that's what I did.

>>> +
>>> +    /* we don't support having both registers simultaneously for
>>> now */
>>> +    if (config->reg_dir_out_base && config->reg_dir_in_base)
>>> +        return ERR_PTR(-EINVAL);
>>
>> and this second test seems to contradict the notion of 'both input and
>> output' above?
> 
> dir_out_base is used if the register is high active to select an output.
> dir_in_base is used for a low active register. Thus both bases are used
> to switch a GPIO between input and output.

ok, makes sense now, thanks for the explanations.

>> re-adding comment from previous series:
>>  >> I still have a series of odd warnings I didn't have before: >> >>
>> [  101.400263] WARNING: CPU: 3 PID: 1129 at >>
>> drivers/gpio/gpiolib.c:4084 gpiod_set_value+0x3f/0x50 >> >> This seems
>> to come from >>     /* Should be using gpiod_set_value_cansleep() */
>>>>     WARN_ON(desc->gdev->chip->can_sleep); > > Right now,
>> gpio-regmap hardcodes can_sleep to true. But the only regmap > which
>> don't sleep is regmap-mmio. The PCM512x seems to be either I2C or >
>> SPI, which can both sleep. So this warning is actually correct and >
>> wherever this gpio is set should do it by calling the _cansleep() >
>> version.
>>
>> I still have the warnings with this version, not sure if you wanted to
>> fix it in the v6 or is this needs to be fixed in another piece of
>> code/patch. How would we go about removing this warning?
> 
> There is no fix in gpio-regmap. wherever this GPIO is connected to must
> not call gpiod_set_value() but have to use gpiod_set_value_cansleep().

yes, I figured this out and corrected the drivers, works just fine now. 
My cleaned-up code is at 
https://github.com/thesofproject/linux/pull/1945, I'll resubmit the v2 
based on these patches when they are merged and available in Mark 
Brown's tree (and I need to address the clock-related feedback).

Thanks for your work Michael, really nice and useful, feel free to add 
the following tag:

Tested-by: Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ