[PATCH v4 3/7] mfd: Add base driver for Netronix embedded controller

Lee Jones lee.jones at linaro.org
Wed Dec 2 08:06:09 EST 2020


On Wed, 02 Dec 2020, Lee Jones wrote:

> On Sun, 22 Nov 2020, Jonathan Neuschäfer wrote:
> 
> > The Netronix embedded controller is a microcontroller found in some
> > e-book readers designed by the original design manufacturer Netronix,
> > Inc. It contains RTC, battery monitoring, system power management, and
> > PWM functionality.
> > 
> > This driver implements register access and version detection.
> > 
> > Third-party hardware documentation is available at:
> > 
> >   https://github.com/neuschaefer/linux/wiki/Netronix-MSP430-embedded-controller
> > 
> > The EC supports interrupts, but the driver doesn't make use of them so
> > far.
> > 
> > Signed-off-by: Jonathan Neuschäfer <j.neuschaefer at gmx.net>
> > ---
> > 
> > v4:
> > - include asm/unaligned.h after linux/*
> > - Use put_unaligned_be16 instead of open-coded big-endian packing
> > - Clarify that 0x90=0xff00 causes an error in downstream kernel too
> > - Add commas after non-sentinel positions
> > - ntxec.h: declare structs device and regmap
> > - Replace WARN_ON usage and add comments to explain errors
> > - Replace dev_alert with dev_warn when the result isn't handled
> > - Change subdevice registration error message to dev_err
> > - Declare ntxec_reg8 as returning __be16
> > - Restructure version detection code
> > - Spell out ODM
> > 
> > v3:
> > - https://lore.kernel.org/lkml/20200924192455.2484005-4-j.neuschaefer@gmx.net/
> > - Add (EC) to CONFIG_MFD_NTXEC prompt
> > - Relicense as GPLv2 or later
> > - Add email address to copyright line
> > - remove empty lines in ntxec_poweroff and ntxec_restart functions
> > - Split long lines
> > - Remove 'Install ... handler' comments
> > - Make naming of struct i2c_client parameter consistent
> > - Remove struct ntxec_info
> > - Rework 'depends on' lines in Kconfig, hard-depend on I2C, select REGMAP_I2C and
> >   MFD_CORE
> > - Register subdevices via mfd_cells
> > - Move 8-bit register conversion to ntxec.h
> > 
> > v2:
> > - https://lore.kernel.org/lkml/20200905133230.1014581-4-j.neuschaefer@gmx.net/
> > - Add a description of the device to the patch text
> > - Unify spelling as 'Netronix embedded controller'.
> >   'Netronix' is the proper name of the manufacturer, but 'embedded controller'
> >   is just a label that I have assigned to the device.
> > - Switch to regmap, avoid regmap use in poweroff and reboot handlers.
> >   Inspired by cf84dc0bb40f4 ("mfd: rn5t618: Make restart handler atomic safe")
> > - Use a list of known-working firmware versions instead of checking for a
> >   known-incompatible version
> > - Prefix registers with NTXEC_REG_
> > - Define register values as constants
> > - Various style cleanups as suggested by Lee Jones
> > - Don't align = signs in struct initializers [Uwe Kleine-König]
> > - Don't use dev_dbg for an error message
> > - Explain sleep in poweroff handler
> > - Remove (struct ntxec).client
> > - Switch to .probe_new in i2c driver
> > - Add .remove callback
> > - Make CONFIG_MFD_NTXEC a tristate option
> > ---
> >  drivers/mfd/Kconfig       |  11 ++
> >  drivers/mfd/Makefile      |   1 +
> >  drivers/mfd/ntxec.c       | 216 ++++++++++++++++++++++++++++++++++++++
> >  include/linux/mfd/ntxec.h |  34 ++++++
> >  4 files changed, 262 insertions(+)
> >  create mode 100644 drivers/mfd/ntxec.c
> >  create mode 100644 include/linux/mfd/ntxec.h

[...]

> > +	/* Bail out if we encounter an unknown firmware version */
> > +	switch (version) {
> > +	case 0xd726: /* found in Kobo Aura */
> 
> No magic numbers.
> 
> Please submit a subsequent patch to define this.
> 
> > +		break;
> > +	default:
> > +		dev_err(ec->dev,
> > +			"Netronix embedded controller version %04x is not supported.\n",
> > +			version);
> > +		return -ENODEV;
> > +	}
> 
> Applied, thanks.

Sorry, that should have been:

For my own reference (apply this as-is to your sign-off block):

  Acked-for-MFD-by: Lee Jones <lee.jones at linaro.org>

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog



More information about the linux-arm-kernel mailing list