Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp4088883rwl; Sat, 7 Jan 2023 10:49:46 -0800 (PST) X-Google-Smtp-Source: AMrXdXu6ov2NvQoMGmSCLCKsbRcaGqxfjt/CRKAzYJdWsbH+TrevvstWfVoCLyvqMBb/3DSzrzTS X-Received: by 2002:a17:902:e88e:b0:189:8a45:8e31 with SMTP id w14-20020a170902e88e00b001898a458e31mr116940214plg.15.1673117386260; Sat, 07 Jan 2023 10:49:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673117386; cv=none; d=google.com; s=arc-20160816; b=oN6MVt75H1OXRVa7RNwvQRd2IT84nKxUFaVHoQFWyoZ8nIq1ykBDpBo3Pu/Wl9g8Sk swrLCaaae3dtqkQGWLl/Tg0LhyArDZwCoXK4ST8GanqUrXfbYHcWH+c1rSBWvbSYJAH8 WXOIuEs1Q3wPovFKoxX/WfzOe/DrPWqGg6RjJqwKo8+tSPIv5GYw8BflTJQ+v+bE7xDQ AGGFwYG27+l6uZMjFTZBehm0lBfZynkVQZQOru4dcMMCMsChX9hQ2mML02wMt3k2fkB7 +6AwxcRoJb6mDPY5GXodC/qjt/gIneCKWulTCGKAg6I1+M7YsiUvHG9MSqexRXup13jB Nl5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=Z/GRMjDgT48jRfAFGb2uOibdVksbJjC1KC+OPBUllYg=; b=hYOyqeVeQN4fOXrJ6Ja51+C38Qfl1URjyAxnzJbMjwg7fXqk4emW2WQpZ4fNG959Br P81cFTKOZut0GgzsKmUy7KVj8o2wRQc31xSnbD2SmTPpDZKn/zytSEzYLHPSKx32MEMB 7Mwl4Qbf1SJBJzbPEdXFFXcg4d1B36zpkMoxGGHgVX3VaUuaoTiDiSat3HzLcts9pSET 5yP+udvf91cl3yw+G4pz6B976Wt6+IZZ2b6AsY55mFGI6fERu+fNautOeQMmCOpHzCzf yPvADqdqIQzp9Grrt+s45Ojw15GZOXOmR7umiuiddAJ7RJvrI4ViaGKL6auTmRQLZl8f LfuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=At+P0Mjb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jw9-20020a170903278900b00192e61bce5fsi4194023plb.416.2023.01.07.10.49.39; Sat, 07 Jan 2023 10:49:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=At+P0Mjb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231445AbjAGSSQ (ORCPT + 54 others); Sat, 7 Jan 2023 13:18:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229542AbjAGSSO (ORCPT ); Sat, 7 Jan 2023 13:18:14 -0500 Received: from mail-vs1-xe32.google.com (mail-vs1-xe32.google.com [IPv6:2607:f8b0:4864:20::e32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF2991CFF4; Sat, 7 Jan 2023 10:18:13 -0800 (PST) Received: by mail-vs1-xe32.google.com with SMTP id v127so268207vsb.12; Sat, 07 Jan 2023 10:18:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Z/GRMjDgT48jRfAFGb2uOibdVksbJjC1KC+OPBUllYg=; b=At+P0MjbS/YAzK02cHZLVHTnCuhC0GvUcA3sK4qi1hWbJ1vMP9JDBKZ6lo7uG9Q0em lOV1ZyRCU2K8dDYXkVpsdnIwJJrjDQF45U0SCMSzWL+ey7SZ7cu2VKJxEAlHxfrlxYBP 3LSNS2idXpdzaEPn1Hi3i08C0fp7VDXbpPeYnrhgL6yXpr6P0L7pPWO6A++rQSUrRliT /CqEuXp8tfcYBQzhsApXJ1ruiugOO7QVxZRFGznrzjWCUgtJ9Tu0a/b+7uj4QA+ObZfE PUyAblGUXUBihesc4Rp9rswN4yBtUD5Wmvj+AU6yUpsg0e4SLBZwSRv7B1JoORxdHI7w ASHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Z/GRMjDgT48jRfAFGb2uOibdVksbJjC1KC+OPBUllYg=; b=syD3wXe+fHbksX+V7YmPU197L9DtDgAmEIboijPgUgkX9ifR1Ja7AE9K9bttZV/84L +rYrKmprnJuC9fzJtUg0+lEh0xgUcF5J4nC9qfzRAZ01j5WfZy/2U1coRvzPX4iPP9J7 Ol+yOBuMoLyc+FT8zC6YinZwY7/+Lhy3+QcFiMuweLbYbi8fsj6FKzrKHRtxXjGD430E OfmV8oQjk22TDE2mV2ILyxN/cPczL6jdYK77yEzQ7vr5eeEmgQHujTMwaeNQrv+5W/YP 52ZZMdDo1dZPTfLZfmlF0iOtmSJlpl9VFsApwzZwzFP+HzaZpFFeTt/NtTYCKgHO5/8j uN6Q== X-Gm-Message-State: AFqh2kp4b1VXx7OEgKkb7UeE0a0I5uIZi8LKpMQUIH301vZfqM/6ZME7 35icOv1Ru3kDNh3gGpCn4fab//tIy24wI3ismIU= X-Received: by 2002:a67:fe44:0:b0:3ce:3974:4558 with SMTP id m4-20020a67fe44000000b003ce39744558mr3447558vsr.0.1673115493045; Sat, 07 Jan 2023 10:18:13 -0800 (PST) MIME-Version: 1.0 References: <20221215150214.1109074-1-hugo@hugovil.com> <20221215150214.1109074-9-hugo@hugovil.com> In-Reply-To: <20221215150214.1109074-9-hugo@hugovil.com> From: Bruno Thomsen Date: Sat, 7 Jan 2023 19:17:57 +0100 Message-ID: Subject: Re: [PATCH v3 08/14] rtc: pcf2127: add support for PCF2131 interrupts on output INT_A To: Hugo Villeneuve Cc: a.zummo@towertech.it, alexandre.belloni@bootlin.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, linux-rtc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Hugo Villeneuve Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Den tor. 15. dec. 2022 kl. 16.20 skrev Hugo Villeneuve : > > From: Hugo Villeneuve > > The PCF2127 and PCF2129 have one output interrupt pin. The PCF2131 has > two, named INT_A and INT_B. The hardware support that any interrupt > source can be routed to either one or both of them. > > Force all interrupt sources to go to the INT A pin. > > Support to route any interrupt source to INT A/B pins is not supported > by this driver at the moment. > > Signed-off-by: Hugo Villeneuve Reviewed-by: Bruno Thomsen > --- > drivers/rtc/rtc-pcf2127.c | 35 +++++++++++++++++++++++++++++++++++ > 1 file changed, 35 insertions(+) > > diff --git a/drivers/rtc/rtc-pcf2127.c b/drivers/rtc/rtc-pcf2127.c > index 4148e135f935..68af4d0438b8 100644 > --- a/drivers/rtc/rtc-pcf2127.c > +++ b/drivers/rtc/rtc-pcf2127.c > @@ -191,6 +191,7 @@ struct pcf21xx_config { > int max_register; > unsigned int has_nvmem:1; > unsigned int has_bit_wd_ctl_cd0:1; > + unsigned int has_int_a_b:1; /* PCF2131 supports two interrupt outputs. */ > u8 regs_td_base; /* Time/data base registers. */ > u8 regs_alarm_base; /* Alarm function base registers. */ > u8 reg_wd_ctl; /* Watchdog control register. */ > @@ -879,6 +880,7 @@ static struct pcf21xx_config pcf21xx_cfg[] = { > .max_register = 0x1d, > .has_nvmem = 1, > .has_bit_wd_ctl_cd0 = 1, > + .has_int_a_b = 0, > .regs_td_base = PCF2127_REG_TIME_DATE_BASE, > .regs_alarm_base = PCF2127_REG_ALARM_BASE, > .reg_wd_ctl = PCF2127_REG_WD_CTL, > @@ -902,6 +904,7 @@ static struct pcf21xx_config pcf21xx_cfg[] = { > .max_register = 0x19, > .has_nvmem = 0, > .has_bit_wd_ctl_cd0 = 0, > + .has_int_a_b = 0, > .regs_td_base = PCF2127_REG_TIME_DATE_BASE, > .regs_alarm_base = PCF2127_REG_ALARM_BASE, > .reg_wd_ctl = PCF2127_REG_WD_CTL, > @@ -925,6 +928,7 @@ static struct pcf21xx_config pcf21xx_cfg[] = { > .max_register = 0x36, > .has_nvmem = 0, > .has_bit_wd_ctl_cd0 = 0, > + .has_int_a_b = 1, > .regs_td_base = PCF2131_REG_TIME_DATE_BASE, > .regs_alarm_base = PCF2131_REG_ALARM_BASE, > .reg_wd_ctl = PCF2131_REG_WD_CTL, > @@ -1017,6 +1021,28 @@ static int pcf2127_enable_ts(struct device *dev, int ts_id) > return ret; > } > > +/* Route all interrupt sources to INT A pin. */ > +static int pcf2127_configure_interrupt_pins(struct device *dev) > +{ > + struct pcf2127 *pcf2127 = dev_get_drvdata(dev); > + int ret; > + > + /* Mask bits need to be cleared to enable corresponding > + * interrupt source. > + */ > + ret = regmap_write(pcf2127->regmap, > + PCF2131_REG_INT_A_MASK1, 0); > + if (ret) > + return ret; > + > + ret = regmap_write(pcf2127->regmap, > + PCF2131_REG_INT_A_MASK2, 0); > + if (ret) > + return ret; > + > + return ret; > +} > + > static int pcf2127_probe(struct device *dev, struct regmap *regmap, > int alarm_irq, const char *name, const struct pcf21xx_config *config) > { > @@ -1076,6 +1102,15 @@ static int pcf2127_probe(struct device *dev, struct regmap *regmap, > set_bit(RTC_FEATURE_ALARM, pcf2127->rtc->features); > } > > + if (pcf2127->cfg->has_int_a_b) { > + /* Configure int A/B pins, independently of alarm_irq. */ > + ret = pcf2127_configure_interrupt_pins(dev); > + if (ret) { > + dev_err(dev, "failed to configure interrupt pins\n"); > + return ret; > + } > + } > + > if (pcf2127->cfg->has_nvmem) { > struct nvmem_config nvmem_cfg = { > .priv = pcf2127, > -- > 2.30.2 >