Re: [rtc-linux] [PATCH v2 4/4] rtc: rv8803: Be able to set VDETOFF and SWOFF via devcie tree

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

 




On 22/06/2016 at 08:42:22 +0200, Dirk Behme wrote :
> From: Oleksij Rempel <fixed-term.Oleksij.Rempel@xxxxxxxxxxxx>
> 
> There might be designs where the power supply circuit is designed
> in a way that VDETOFF and SWOFF is reuqired to be set. Otherwise the
> RTC detects a power loss. Add a device tree interface for this.
> 
> Signed-off-by: Carsten Resch <Carsten.Resch@xxxxxxxxxxxx>
> Signed-off-by: Dirk Behme <dirk.behme@xxxxxxxxxxxx>
> Signed-off-by: Oleksij Rempel <fixed-term.Oleksij.Rempel@xxxxxxxxxxxx>
> Cc: devicetree@xxxxxxxxxxxxxxx
> ---
>  drivers/rtc/rtc-rv8803.c | 39 +++++++++++++++++++++++++++++++++++++++
>  1 file changed, 39 insertions(+)
> 
> diff --git a/drivers/rtc/rtc-rv8803.c b/drivers/rtc/rtc-rv8803.c
> index e122b51..32a5686 100644
> --- a/drivers/rtc/rtc-rv8803.c
> +++ b/drivers/rtc/rtc-rv8803.c
> @@ -50,6 +50,10 @@
>  #define RV8803_CTRL_TIE			BIT(4)
>  #define RV8803_CTRL_UIE			BIT(5)
>  
> +#define RX8900_BACKUP_CTRL		0x18
> +#define RX8900_FLAG_SWOFF		BIT(2)
> +#define RX8900_FLAG_VDETOFF		BIT(3)
> +
>  struct rv8803_data {
>  	struct i2c_client *client;
>  	struct rtc_device *rtc;
> @@ -423,6 +427,35 @@ static struct rtc_class_ops rv8803_rtc_ops = {
>  	.ioctl = rv8803_ioctl,
>  };
>  
> +static int rx8900_trickle_charger_init(struct rv8803_data *rv8803)
> +{
> +	struct i2c_client *client = rv8803->client;
> +	struct device_node *node = client->dev.of_node;
> +	int err;
> +	u8 flags;
> +
> +	if (!node)
> +		return 0;
> +
> +	if (!of_device_is_compatible(node, "epson,rx8900"))
> +		return 0;
> +

Can you use the i2c_device_id instead of of_device_is_compatible to
avoid matching on yet another string?


-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]
  Powered by Linux