linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: jerome Neanne <jneanne@baylibre.com>
To: Biju Das <biju.das.jz@bp.renesas.com>,
	"lgirdwood@gmail.com" <lgirdwood@gmail.com>,
	"broonie@kernel.org" <broonie@kernel.org>,
	"robh+dt@kernel.org" <robh+dt@kernel.org>,
	"nm@ti.com" <nm@ti.com>, "kristo@kernel.org" <kristo@kernel.org>,
	"dmitry.torokhov@gmail.com" <dmitry.torokhov@gmail.com>,
	"krzysztof.kozlowski+dt@linaro.org" 
	<krzysztof.kozlowski+dt@linaro.org>,
	"catalin.marinas@arm.com" <catalin.marinas@arm.com>,
	"will@kernel.org" <will@kernel.org>,
	"lee.jones@linaro.org" <lee.jones@linaro.org>,
	"tony@atomide.com" <tony@atomide.com>,
	"vigneshr@ti.com" <vigneshr@ti.com>,
	"bjorn.andersson@linaro.org" <bjorn.andersson@linaro.org>,
	"shawnguo@kernel.org" <shawnguo@kernel.org>,
	"geert+renesas@glider.be" <geert+renesas@glider.be>,
	"dmitry.baryshkov@linaro.org" <dmitry.baryshkov@linaro.org>,
	"marcel.ziswiler@toradex.com" <marcel.ziswiler@toradex.com>,
	"vkoul@kernel.org" <vkoul@kernel.org>,
	"arnd@arndb.de" <arnd@arndb.de>,
	"jeff@labundy.com" <jeff@labundy.com>
Cc: "afd@ti.com" <afd@ti.com>,
	"khilman@baylibre.com" <khilman@baylibre.com>,
	"narmstrong@baylibre.com" <narmstrong@baylibre.com>,
	"msp@baylibre.com" <msp@baylibre.com>,
	"j-keerthy@ti.com" <j-keerthy@ti.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"linux-input@vger.kernel.org" <linux-input@vger.kernel.org>,
	"linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>
Subject: Re: [PATCH v5 4/6] mfd: tps65219: Add driver for TI TPS65219 PMIC
Date: Mon, 31 Oct 2022 15:45:03 +0100	[thread overview]
Message-ID: <a2000dfa-6872-fdf5-c636-755ae5a82728@baylibre.com> (raw)
In-Reply-To: <OS0PR01MB59221A8415766E7E3615F39E86379@OS0PR01MB5922.jpnprd01.prod.outlook.com>



On 31/10/2022 12:13, Biju Das wrote:
> Hi,
> 
>> Subject: [PATCH v5 4/6] mfd: tps65219: Add driver for TI TPS65219 PMIC
>>
>> The TPS65219 is a power management IC PMIC designed to supply a wide range
>> of SoCs in both portable and stationary applications. Any SoC can control
>> TPS65219 over a standard I2C interface.
>>
>> It contains the following components:
>> - Regulators.
>> - Over Temperature warning and Shut down.
>> - GPIOs
>> - Multi Function Pins (MFP)
>> - power-button
>>
>> This patch adds support for tps65219 PMIC. At this time only the
>> functionalities listed below are made available:
>>
>> - Regulators probe and functionalities
>> - warm and cold reset support
>> - SW shutdown support
>> - Regulator warnings via IRQs
>> - Power-button via IRQ
>>
>> Signed-off-by: Jerome Neanne <jneanne@baylibre.com>
>> Signed-off-by: Markus Schneider-Pargmann <msp@baylibre.com>
>> ---
>>   MAINTAINERS                  |   1 +
>>   drivers/mfd/Kconfig          |  14 ++
>>   drivers/mfd/Makefile         |   1 +
>>   drivers/mfd/tps65219.c       | 320 ++++++++++++++++++++++++++++++++
>>   include/linux/mfd/tps65219.h | 345 +++++++++++++++++++++++++++++++++++
>>   5 files changed, 681 insertions(+)
>>   create mode 100644 drivers/mfd/tps65219.c  create mode 100644
>> include/linux/mfd/tps65219.h
>>
>> diff --git a/MAINTAINERS b/MAINTAINERS
>> index f35b29ffd5fb..960df879c635 100644
>> --- a/MAINTAINERS
>> +++ b/MAINTAINERS
>> @@ -14926,6 +14926,7 @@ F:	drivers/mfd/menelaus.c
>>   F:	drivers/mfd/palmas.c
>>   F:	drivers/mfd/tps65217.c
>>   F:	drivers/mfd/tps65218.c
>> +F:	drivers/mfd/tps65219.c
>>   F:	drivers/mfd/tps65910.c
>>   F:	drivers/mfd/twl-core.[ch]
>>   F:	drivers/mfd/twl4030*.c
>> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index
>> abb58ab1a1a4..1a846c7dd0c2 100644
>> --- a/drivers/mfd/Kconfig
>> +++ b/drivers/mfd/Kconfig
>> @@ -1576,6 +1576,20 @@ config MFD_TPS65218
>>   	  This driver can also be built as a module.  If so, the module
>>   	  will be called tps65218.
>>
>> +config MFD_TPS65219
>> +	tristate "TI TPS65219 Power Management IC"
>> +	depends on I2C && OF
>> +	select MFD_CORE
>> +	select REGMAP_I2C
>> +	select REGMAP_IRQ
>> +	help
>> +	  If you say yes here you get support for the TPS65219 series of
>> Power
>> +	  Management ICs. These include voltage regulators, GPIOs and
>> +	  push/power button that are often used in portable devices.
>> +
>> +	  This driver can also be built as a module. If so, the module
>> +	  will be called tps65219.
>> +
>>   config MFD_TPS6586X
>>   	bool "TI TPS6586x Power Management chips"
>>   	depends on I2C=y
>> diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index
>> 858cacf659d6..a8ff3d6ea3ab 100644
>> --- a/drivers/mfd/Makefile
>> +++ b/drivers/mfd/Makefile
>> @@ -101,6 +101,7 @@ obj-$(CONFIG_TPS6507X)		+= tps6507x.o
>>   obj-$(CONFIG_MFD_TPS65086)	+= tps65086.o
>>   obj-$(CONFIG_MFD_TPS65217)	+= tps65217.o
>>   obj-$(CONFIG_MFD_TPS65218)	+= tps65218.o
>> +obj-$(CONFIG_MFD_TPS65219)	+= tps65219.o
>>   obj-$(CONFIG_MFD_TPS65910)	+= tps65910.o
>>   obj-$(CONFIG_MFD_TPS65912)	+= tps65912-core.o
>>   obj-$(CONFIG_MFD_TPS65912_I2C)	+= tps65912-i2c.o
>> diff --git a/drivers/mfd/tps65219.c b/drivers/mfd/tps65219.c new file mode
>> 100644 index 000000000000..c1638483e069
>> --- /dev/null
>> +++ b/drivers/mfd/tps65219.c
>> @@ -0,0 +1,320 @@
>> +// SPDX-License-Identifier: GPL-2.0
>> +//
>> +// Driver for TPS65219 Integrated Power Management Integrated Chips
>> +(PMIC) // // Copyright (C) 2022 BayLibre Incorporated -
>> +
>> +#include <linux/device.h>
>> +#include <linux/err.h>
>> +#include <linux/i2c.h>
>> +#include <linux/init.h>
>> +#include <linux/interrupt.h>
>> +#include <linux/irq.h>
>> +#include <linux/kernel.h>
>> +#include <linux/module.h>
>> +#include <linux/of_device.h>
>> +#include <linux/of.h>
>> +#include <linux/platform_device.h>
>> +#include <linux/reboot.h>
>> +#include <linux/regmap.h>
>> +#include <linux/slab.h>
> 
> Do you need all the includes??
>
No! you're right, I'll remove not needed.
>> +
>> +#include <linux/mfd/core.h>
>> +#include <linux/mfd/tps65219.h>
>> +
>> +static int tps65219_warm_reset(struct tps65219 *tps) {
>> +	return regmap_update_bits(tps->regmap, TPS65219_REG_MFP_CTRL,
>> +				  TPS65219_MFP_WARM_RESET_I2C_CTRL_MASK,
>> +				  TPS65219_MFP_WARM_RESET_I2C_CTRL_MASK);
>> +}
>> +
>> +static int tps65219_cold_reset(struct tps65219 *tps) {
>> +	return regmap_update_bits(tps->regmap, TPS65219_REG_MFP_CTRL,
>> +				  TPS65219_MFP_COLD_RESET_I2C_CTRL_MASK,
>> +				  TPS65219_MFP_COLD_RESET_I2C_CTRL_MASK);
>> +}
>> +
>> +static int tps65219_soft_shutdown(struct tps65219 *tps) {
>> +	return regmap_update_bits(tps->regmap, TPS65219_REG_MFP_CTRL,
>> +				  TPS65219_MFP_I2C_OFF_REQ_MASK,
>> +				  TPS65219_MFP_I2C_OFF_REQ_MASK);
>> +}
>> +
>> +static int tps65219_restart(struct notifier_block *this,
>> +			    unsigned long reboot_mode, void *cmd) {
>> +	struct tps65219 *tps;
>> +
>> +	tps = container_of(this, struct tps65219, nb);
>> +	if (!tps) {
>> +		pr_err("tps65219: Restarting failed because the pointer to
>> tps65219 is invalid\n");
> Why not dev_error?
Because I can't get correct device then: if !tps, I can't get tps->dev 
Then can't reference device in dev_error. Do you have a better 
suggestion than this pr_err?

Best regards,
Jerome.

  reply	other threads:[~2022-10-31 14:45 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-14 14:07 [PATCH v5 0/6] Add support for TI TPS65219 PMIC Jerome Neanne
2022-09-14 14:07 ` [PATCH v5 1/6] DONOTMERGE: arm64: dts: ti: Add TI TPS65219 PMIC support for AM642 SK board Jerome Neanne
2022-09-14 14:07 ` [PATCH v5 2/6] DONOTMERGE: arm64: dts: ti: Add pinmux and irq mapping for TPS65219 external interrupts Jerome Neanne
2022-09-14 14:07 ` [PATCH v5 3/6] DONOTMERGE: arm64: dts: ti: k3-am642-sk: Enable tps65219 power-button Jerome Neanne
2022-09-14 14:07 ` [PATCH v5 4/6] mfd: tps65219: Add driver for TI TPS65219 PMIC Jerome Neanne
2022-10-31 11:13   ` Biju Das
2022-10-31 14:45     ` jerome Neanne [this message]
2022-10-31 14:48       ` Biju Das
2022-10-31 15:14         ` jerome Neanne
2022-09-14 14:07 ` [PATCH v5 5/6] Input: Add tps65219 interrupt driven powerbutton Jerome Neanne
2022-09-14 14:07 ` [PATCH v5 6/6] arm64: defconfig: Add tps65219 as modules Jerome Neanne
  -- strict thread matches above, loose matches on Subject: below --
2022-09-27  8:35 [PATCH v5 0/6] Add support for TI TPS65219 PMIC Jerome Neanne
2022-09-27  8:35 ` [PATCH v5 4/6] mfd: tps65219: Add driver " Jerome Neanne
2022-09-13 12:14 [PATCH v5 0/6] Add support " Jerome Neanne
2022-09-13 12:14 ` [PATCH v5 4/6] mfd: tps65219: Add driver " Jerome Neanne
2022-09-14  6:46   ` Lee Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a2000dfa-6872-fdf5-c636-755ae5a82728@baylibre.com \
    --to=jneanne@baylibre.com \
    --cc=afd@ti.com \
    --cc=arnd@arndb.de \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=broonie@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=geert+renesas@glider.be \
    --cc=j-keerthy@ti.com \
    --cc=jeff@labundy.com \
    --cc=khilman@baylibre.com \
    --cc=kristo@kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=lee.jones@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=marcel.ziswiler@toradex.com \
    --cc=msp@baylibre.com \
    --cc=narmstrong@baylibre.com \
    --cc=nm@ti.com \
    --cc=robh+dt@kernel.org \
    --cc=shawnguo@kernel.org \
    --cc=tony@atomide.com \
    --cc=vigneshr@ti.com \
    --cc=vkoul@kernel.org \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).