Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2874830imu; Wed, 7 Nov 2018 00:41:51 -0800 (PST) X-Google-Smtp-Source: AJdET5epnXExc3sveBdKaK77eEOVDdA9jlh2J8RYewA2D+neryI30G9ZjQA8Ej107xart+PH5ID8 X-Received: by 2002:a65:5c81:: with SMTP id a1-v6mr841354pgt.390.1541580111694; Wed, 07 Nov 2018 00:41:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541580111; cv=none; d=google.com; s=arc-20160816; b=O4kk/rX8jduULgwxfJhFOPPlSVw70LNqwGz61OvYm4eaq6YRba4V77Sx01RGwEsvfJ CSKzHI829zlT5JGpEKKfsD4bSuP3XGeUgCSkJ0zIJI4Q7orkGnv577sbdlQHhXmjkiR4 NT/qGmM2zUv2eWHvotNSUc+FncxhFh4sSX2f77FMs6ehvn/woDEhjo+hgml+bgxWawvF x4dN48aLtfSVRZitPfDjZYHdIAK1XKFyrs5sy1lNiivQ0c3Sq4prtOyKYq84CDpuzR2x MULtoS2Heqy/lfCq82vlq+FlIQldKdaskJXe4zdJeKigZfmFimJSJz4v+drv94BwEwkq HblA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=ZFTtJn0e12aMuFN/NK2Fwvdbn+D3VzC033GvZhFZ66o=; b=blL2uzFXrUpHPiHNOiDnhVBm9gUsqjqgb9TtOLSEc8mn4dnUZLYca1+ssJjXcQMyAr ugTzGWQUvfc9rtqvAf/CQG7VQrPIH3F5/F+GJlapa9vaRPz/qki7l6YRNLzg9l72kmmZ rqn5L1fNkKz3Nz0CbOym9CAr3tQFbRo9MlzYbTJyT9hXnVhxa9JHM14BeVbZgqAcTbGZ /1QnlleuBO6vYu0ROOU5ouTV8w4oeF0HKisuc3QJ1uI0s+iqD3XVuwFZwLf7khmwgh0w JOFWsxh629X0S5hIf30lAFq6iWoVx77uvsaQ+2Pi5N8TbjgkLT7Lmw6UKcnMarqtPzqz jNjA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l11-v6si10653567plt.5.2018.11.07.00.41.36; Wed, 07 Nov 2018 00:41:51 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730024AbeKGSJI (ORCPT + 99 others); Wed, 7 Nov 2018 13:09:08 -0500 Received: from mail-vs1-f68.google.com ([209.85.217.68]:36560 "EHLO mail-vs1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726171AbeKGSJI (ORCPT ); Wed, 7 Nov 2018 13:09:08 -0500 Received: by mail-vs1-f68.google.com with SMTP id v205so8989578vsc.3; Wed, 07 Nov 2018 00:39:47 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ZFTtJn0e12aMuFN/NK2Fwvdbn+D3VzC033GvZhFZ66o=; b=dKc2ttnltoda7Cgf5ei5gp/M8puAMmTKDTQXdEcWegFnvmkmUm7pdNJHHtMGU1URlL p6AgMdRP4zM+Qnu36+ADC56FJT39qqPMxWzAi9Pa/7wVWPunt/HotiPHQAbNTYGVFQUM y6r8XoSEklIUfkCd8jWUAOutcxaxMNmP3YQxdr1GsrFHhqqfm/gbJ/DQKKbc8cNySAfJ Ac8FC3VALfheFGCDNhAQgHK1dM74kZcW9pNscZetPySK7R4RRgOCtWLGTKg4AmblRiyA t/hT54PQ0wYV/rmnh06PMvwRSqYXYh8tft7en4tEgJRinqNiGOet6oaR+N5C65qL7XuI QbTw== X-Gm-Message-State: AGRZ1gI+SvtQMtpyUHnStQ8mbS7iQz1D1jcFANXQ/ehFpV92siafWYYu sgFrAYGJ+axV7K3OlQC7KfQzP/DR9z+qJa2eosg= X-Received: by 2002:a67:b404:: with SMTP id x4mr380152vsl.152.1541579986970; Wed, 07 Nov 2018 00:39:46 -0800 (PST) MIME-Version: 1.0 References: <1540836824-4636-1-git-send-email-jacopo+renesas@jmondi.org> <20181106090756.GP20885@w540> <20181106093121.GA24024@w540> In-Reply-To: <20181106093121.GA24024@w540> From: Geert Uytterhoeven Date: Wed, 7 Nov 2018 09:39:35 +0100 Message-ID: Subject: Re: [PATCH 0/2] pinctrl: sh-pfc: r8a77965: Add VIN4 and VIN5 To: Jacopo Mondi Cc: Jacopo Mondi , Geert Uytterhoeven , Laurent Pinchart , Simon Horman , Linus Walleij , Linux-Renesas , "open list:GPIO SUBSYSTEM" , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jacopo, (sorry, seems I prepared a reply, but forgot to press "Send") On Tue, Nov 6, 2018 at 10:31 AM jacopo mondi wrote: > On Tue, Nov 06, 2018 at 10:24:30AM +0100, Geert Uytterhoeven wrote: > > On Tue, Nov 6, 2018 at 10:08 AM jacopo mondi wrote: > > > On Mon, Nov 05, 2018 at 06:19:22PM +0100, Geert Uytterhoeven wrote: > > > > On Mon, Oct 29, 2018 at 7:14 PM Jacopo Mondi wrote: > > > > > this two patches add supports for VIN4 and VIN5 interfaces to R-Car M3-N. > > > > > > > > > > On this SoC (and in the forthcoming support for E3 R8A77990) the VIN groups > > > > > could appear on different sets of pins, usually the 'a' and 'b' one. > > > > > > > > > > With the existing VIN_DATA_PIN_GROUP macro we have to specify group names as: > > > > > > > > > > VIN_DATA_PIN_GROUP(vin4_data_a, 8) > > > > > > > > > > which results in the group being named as "vin4_data_a_8" which is > > > > > un-consistent with the canonical group names (eg. "vin4_data8_a"). > > > > > > > > > > This series adds a macro that allows to specify the group 'version' along with > > > > > the pin and mux numbers in patch [1/1]. I haven't been able to find a better > > > > > term than 'version' as 'group' was already taken. Suggestions welcome. > > > > > > > > Yeah, the datasheet also calls these groups :-( > > > > A possible alternative is to use "variant"? > > > > > > > > Or, what about avoiding the name issue by making the VIN_DATA_PIN_GROUP() > > > > macro varargs, and passing the "variant" as the (optional) third parameter? > > > > That way existing users work as a before, while you can also write e.g. > > > > > > > > VIN_DATA_PIN_GROUP_VER(vin4_data, 8, _a), > > > > > > Indeed. > > > > > > Would something along the following lines fly for you? > > > > > > #define VIN_DATA_PIN_GROUP(n, s, ...) \ > > > { \ > > > .name = #n#s#__VA_ARGS__, \ > > > .pins = n##__VA_ARGS__##_pins.data##s, \ > > > .mux = n##__VA_ARGS__##_mux.data##s, \ > > > .nr_pins = ARRAY_SIZE(n##__VA_ARGS__##_pins.data##s), \ > > > } > > > > > > It can be used as: > > > VIN_DATA_PIN_GROUP(vin4_data, 8, _a), > > > VIN_DATA_PIN_GROUP(vin5_data, 8), > > > > > > With your ack on this, I'll send v2. > > > > Thank you, that is exactly what I had in mind. > > > > > > > As I cannot test VIN4 nor VIN5 on Salvator-XS as the parallel pins are not > > > > > wired, I made sure the macro creates correct names and fields not only by > > > > > compile testing it, but with a small C program [1] that replicates the VIN data > > > > > layout defined in the PFC module and access fields (and has helped me testing > > > > > more easily the preprocessor stringification/concatenation process). > > > > > > > > > > Final note: Simon, you took the E3 patches in your tree, and I expect them to > > > > > land on v4.20-rc1. They use the old macros, are follow up patches ok?) > > > > > > > > Which patches are using these macro names, and are in v4.20-rc1? > > > > > > > > BTW, "grep vin._data_[a-z][0-9] drivers/pinctrl/sh-pfc/*o" tells me we already > > > > have broken groups names on r8a7792, r8a7795, and r8a7796. > > > > Fortunately we have no known users of them, so they can be fixed. > > > > > > > > > > On v4.20-rc1 the grep returns none for me :/ > > > git grep v4.20-rc1 "vin._data_[a-z][0-9]" drivers/pinctrl/sh-pfc/ > > > > I grepped the .o files, to make sure it would see the final strings, which > > obviously works in the build tree only ;-) > > Ah yes, stupid me. > > > > > For the source tree, please try: > > > > git grep -w VIN_DATA_PIN_GROUP.*_[a-z] v4.20-rc1 > > Argh, there are quite a few of them, but fortunately no users so far. > > Is it ok fixing them in v2 of this series with follow-up patches, or > would you like a single patch that introduces the variadic macro and > replaces all the occurrences in the per-SoC PFC modules in one go? Given the r8a7795 and r8a7796 issues were introduced in v4.17: a5c2949ff7bd9e04 ("pinctrl: sh-pfc: r8a7796: Deduplicate VIN4 pin definitions") 9942a5b52990b8d5 ("pinctrl: sh-pfc: r8a7795: Deduplicate VIN4 pin definitions") while the r8a7792 issue date back to v4.9: 7dd74bb1f058786e ("pinctrl: sh-pfc: r8a7792: Add VIN pin groups") I think separate patches are easier for backporting. Thanks! Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds