From patchwork Mon Aug 12 14:14:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 171077 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp2893683ily; Mon, 12 Aug 2019 07:14:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqzVo2E3nMg9AdoWrPJ2rzfZjq1eUL0rIZYPU6MnBKKzdVE+LHb8xxjvNP0tawg87Kl3cFGC X-Received: by 2002:a63:c013:: with SMTP id h19mr30570576pgg.108.1565619293000; Mon, 12 Aug 2019 07:14:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565619292; cv=none; d=google.com; s=arc-20160816; b=AdeKhvSCvQdaQwtebDMXNml97d+lzkTyCVnxn9pe4hKUcSZ9e+degQBm8aWbN+O7kS WksgL3R2pTvwscgSgEj1o1O57lzQoQP1dscQ4I7Lc8aYYazbraxTXZcUkZVlfyguRvG4 PPgenvaRDnlgBioie+5IZOk09MXLnG4Vkh7lbSr+iUqkEVMYG55EeNOy9ZGOzliasQuR sNlAxdS75djCZ4RNXxjdLl96pceVavDcunX7oWKUd8bIUQkmtF8gjyE4H+xZ8MZSUqIN GTbC0ejHqUaBJliUXp6oAND7plEaoe217uEqmhOE+DJNuBR8jkvIv+RkiKT205J7bVOM /qNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=hzmnAdrBvsTZy+67KBYbLZLd3TwZRwodBLS97SMtlW8=; b=eEEvKDr7M0LIH9bVRIK1N52tUMo84wwbWzqjgcIPap6A1C0BJBbOZsOZ0wiYTbyq8A Rp7Ni5tI4uqXE3UQaIfQSH8Le8kqmJoVyDlz2lX4UjMqEzsf1he+2f1Rvel9GI1U6I7D aKeELciNLbrNLkJpdOiQxnGvXqVyZA2gHmQtjZtsNXjLWmVa1b7Z9KVD9dbebzQkoY4P 2G68/UuvB3vq51yGrnI3rqCqTpstW3gIB2Po2WkhEkslaUMQ10v7e+m4A4ScplHpBJvw 4Ol8sUW6WAMqT54AuFNvTsDkAZZGNBOj0YIA2nMZa3aJLkRHZv4jvNNABmb63tEmMTWr r6Nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="h/OJVRAr"; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o15si4226710pll.20.2019.08.12.07.14.52; Mon, 12 Aug 2019 07:14:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="h/OJVRAr"; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726696AbfHLOOw (ORCPT + 5 others); Mon, 12 Aug 2019 10:14:52 -0400 Received: from mail-lf1-f65.google.com ([209.85.167.65]:43370 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726605AbfHLOOw (ORCPT ); Mon, 12 Aug 2019 10:14:52 -0400 Received: by mail-lf1-f65.google.com with SMTP id c19so74344530lfm.10 for ; Mon, 12 Aug 2019 07:14:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=hzmnAdrBvsTZy+67KBYbLZLd3TwZRwodBLS97SMtlW8=; b=h/OJVRArzpDHivjI5N+uRdVNF6wdfPOxQcg+TygzViu/2jqAzdLn7l5O4SBmKNJj9J za+KaHwqxyz4vfdWLCTG9EIbx0PN/89xuF07fW/y4k1ACw4S/fMYQaL82VWB4Eu9rGIF +pvqOVL3Qaf6sc1gS6qxZl3UDepP4QDochamjS75gOkVLHIEt3fqVrvpUEDSsVKCcg78 Jo7lms5C0epHW1xbxM9hysfEPtH2zrHMQeusoq0yOAKhWGu3zRG3L3Es3CULaaqtmFQj kYdTqbRklCFywE4WO7fJU8l+RkUMjKYbxZ8yskFi7pkFCob1uVbezyOGIEk5cYnafP8f j51w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=hzmnAdrBvsTZy+67KBYbLZLd3TwZRwodBLS97SMtlW8=; b=DzmkP2gmGwct85fwndt5G5NP1p+sN3mK0epirsT4F5hVfbCNfy4E6l86mbE4O4liQW SUUvJPP/cbd6U7CUaL5HmpwPm8pK92bx6oiDu/ZLjODY9iQOMfLIxGjMj7FEl6vf+kYg TXnPlO35sCiJbokgHJxo3wGyrVBmeVeGAJT1GkeCQnQHYXPsixvnnw7kgvxjiCtcL7Hp oZss69In06mu8wohtX4sm0blsDtAM7t2yec7VO18kopk3zeMd46/Gk3ux6s6YTusajvw fpUYc9JgFWzTR9NljjB2bBSocv1nxfIiVDvzTuKpi049DsS6m0bXd+0k0PnBXQ8fClCQ 6g9A== X-Gm-Message-State: APjAAAUB9+uQM2MNrBkj0dhuvMQsmao5FygwtRNs+ShuDGAHFw0S7x62 L746fMOwFi9aM76kz1jer0J1lxm7suY= X-Received: by 2002:a19:7908:: with SMTP id u8mr19786982lfc.178.1565619290113; Mon, 12 Aug 2019 07:14:50 -0700 (PDT) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id d16sm6051251lfl.29.2019.08.12.07.14.48 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 12 Aug 2019 07:14:48 -0700 (PDT) From: Linus Walleij To: linux-gpio@vger.kernel.org Cc: Linus Walleij , Andy Shevchenko , Mika Westerberg , Thierry Reding Subject: [PATCH] pinctrl: intel: baytrail: Pass irqchip when adding gpiochip Date: Mon, 12 Aug 2019 16:14:46 +0200 Message-Id: <20190812141446.1090-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org We need to convert all old gpio irqchips to pass the irqchip setup along when adding the gpio_chip. For more info see drivers/gpio/TODO. For chained irqchips this is a pretty straight-forward conversion. Cc: Andy Shevchenko Cc: Mika Westerberg Cc: Thierry Reding Signed-off-by: Linus Walleij --- Andy: when you're happy with this you can either supply an ACK and I will merge it or you can merge it into your tree for a later pull request, just tell me what you prefer. --- drivers/pinctrl/intel/pinctrl-baytrail.c | 38 ++++++++++++++---------- 1 file changed, 22 insertions(+), 16 deletions(-) -- 2.21.0 diff --git a/drivers/pinctrl/intel/pinctrl-baytrail.c b/drivers/pinctrl/intel/pinctrl-baytrail.c index e5a112a8e067..57faddca3710 100644 --- a/drivers/pinctrl/intel/pinctrl-baytrail.c +++ b/drivers/pinctrl/intel/pinctrl-baytrail.c @@ -1533,6 +1533,28 @@ static int byt_gpio_probe(struct byt_gpio *vg) if (!vg->saved_context) return -ENOMEM; #endif + + /* set up interrupts */ + irq_rc = platform_get_resource(vg->pdev, IORESOURCE_IRQ, 0); + if (irq_rc && irq_rc->start) { + struct gpio_irq_chip *girq; + + byt_gpio_irq_init_hw(vg); + + girq = &gc->irq; + girq->chip = &byt_irqchip; + girq->parent_handler = byt_gpio_irq_handler; + girq->num_parents = 1; + girq->parents = devm_kcalloc(&vg->pdev->dev, 1, + sizeof(*girq->parents), + GFP_KERNEL); + if (!girq->parents) + return -ENOMEM; + girq->parents[0] = (unsigned int)irq_rc->start; + girq->default_type = IRQ_TYPE_NONE; + girq->handler = handle_bad_irq; + } + ret = devm_gpiochip_add_data(&vg->pdev->dev, gc, vg); if (ret) { dev_err(&vg->pdev->dev, "failed adding byt-gpio chip\n"); @@ -1546,22 +1568,6 @@ static int byt_gpio_probe(struct byt_gpio *vg) return ret; } - /* set up interrupts */ - irq_rc = platform_get_resource(vg->pdev, IORESOURCE_IRQ, 0); - if (irq_rc && irq_rc->start) { - byt_gpio_irq_init_hw(vg); - ret = gpiochip_irqchip_add(gc, &byt_irqchip, 0, - handle_bad_irq, IRQ_TYPE_NONE); - if (ret) { - dev_err(&vg->pdev->dev, "failed to add irqchip\n"); - return ret; - } - - gpiochip_set_chained_irqchip(gc, &byt_irqchip, - (unsigned)irq_rc->start, - byt_gpio_irq_handler); - } - return ret; }