[0/3] Migrate i8255 GPIO drivers to regmap API

Message ID cover.1667472555.git.william.gray@linaro.org
Headers
Series Migrate i8255 GPIO drivers to regmap API |

Message

William Breathitt Gray Nov. 3, 2022, 11:20 a.m. UTC
  The regmap API supports IO port accessors so we can take advantage of
regmap abstractions rather than handling access to the device registers
directly in the driver.

Precursor patches are provided for 104-dio-48e and 104-idi-48 to migrate
their respective device-specific registers first in order to simplify
the subsequent patch migrating the i8255 library and its dependents.

The struct i8255 control_state member serves as a cache of the i8255
device's control register. Does the regmap API support caching such that
we won't need to manually update a control_state member?

William Breathitt Gray (3):
  gpio: 104-dio-48e: Migrate to regmap API
  gpio: 104-idi-48: Migrate to regmap API
  gpio: i8255: Migrate to regmap API

 drivers/gpio/gpio-104-dio-48e.c | 200 +++++++++++++++++++----------
 drivers/gpio/gpio-104-idi-48.c  | 110 +++++++++++-----
 drivers/gpio/gpio-gpio-mm.c     |  97 ++++++++++----
 drivers/gpio/gpio-i8255.c       | 218 +++++++++++++++++++++-----------
 drivers/gpio/gpio-i8255.h       |  54 ++++----
 5 files changed, 451 insertions(+), 228 deletions(-)


base-commit: b8b80348c57b360019071e17380298619c5d8066
  

Comments

Andy Shevchenko Nov. 7, 2022, 10:37 a.m. UTC | #1
On Thu, Nov 03, 2022 at 07:20:46AM -0400, William Breathitt Gray wrote:
> The regmap API supports IO port accessors so we can take advantage of
> regmap abstractions rather than handling access to the device registers
> directly in the driver.
> 
> Precursor patches are provided for 104-dio-48e and 104-idi-48 to migrate
> their respective device-specific registers first in order to simplify
> the subsequent patch migrating the i8255 library and its dependents.
> 
> The struct i8255 control_state member serves as a cache of the i8255
> device's control register. Does the regmap API support caching such that
> we won't need to manually update a control_state member?

Yes, regmap supports caching and IIRC it's opt-out.

> William Breathitt Gray (3):
>   gpio: 104-dio-48e: Migrate to regmap API
>   gpio: 104-idi-48: Migrate to regmap API
>   gpio: i8255: Migrate to regmap API
> 
>  drivers/gpio/gpio-104-dio-48e.c | 200 +++++++++++++++++++----------
>  drivers/gpio/gpio-104-idi-48.c  | 110 +++++++++++-----
>  drivers/gpio/gpio-gpio-mm.c     |  97 ++++++++++----
>  drivers/gpio/gpio-i8255.c       | 218 +++++++++++++++++++++-----------
>  drivers/gpio/gpio-i8255.h       |  54 ++++----
>  5 files changed, 451 insertions(+), 228 deletions(-)
> 
> 
> base-commit: b8b80348c57b360019071e17380298619c5d8066
> -- 
> 2.37.3
>
  
William Breathitt Gray Nov. 9, 2022, 8:35 p.m. UTC | #2
On Mon, Nov 07, 2022 at 12:37:00PM +0200, Andy Shevchenko wrote:
> On Thu, Nov 03, 2022 at 07:20:46AM -0400, William Breathitt Gray wrote:
> > The regmap API supports IO port accessors so we can take advantage of
> > regmap abstractions rather than handling access to the device registers
> > directly in the driver.
> > 
> > Precursor patches are provided for 104-dio-48e and 104-idi-48 to migrate
> > their respective device-specific registers first in order to simplify
> > the subsequent patch migrating the i8255 library and its dependents.
> > 
> > The struct i8255 control_state member serves as a cache of the i8255
> > device's control register. Does the regmap API support caching such that
> > we won't need to manually update a control_state member?
> 
> Yes, regmap supports caching and IIRC it's opt-out.

Looks like it's disabled by default if I understand correctly: the
cache_type member of struct regmap_config has a default value of
REGCACHE_NONE if not explicitly set. I'll set cache_type to enable
caching and remove the control_state member in v2 then.

William Breathitt Gray