From patchwork Tue Mar 17 09:54:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 450921 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-oi0-x23c.google.com (mail-oi0-x23c.google.com [IPv6:2607:f8b0:4003:c06::23c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 7158F14010F for ; Tue, 17 Mar 2015 20:54:36 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass reason="2048-bit key; unprotected key" header.d=googlegroups.com header.i=@googlegroups.com header.b=Ra3OGdrw; dkim-adsp=none (unprotected policy); dkim-atps=neutral Received: by oigh136 with SMTP id h136sf1162747oig.0 for ; Tue, 17 Mar 2015 02:54:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20120806; h=mime-version:from:to:cc:subject:date:message-id:x-original-sender :x-original-authentication-results:reply-to:content-type:precedence :mailing-list:list-id:list-post:list-help:list-archive:sender :list-subscribe:list-unsubscribe; bh=nIEniId+UVDs6CmwBSaJiiqqTMFKqsqmfCzTujrsxSE=; b=Ra3OGdrwF8SgxVPzaCqlR9nsYkdxr0pCS4S2RQopEKoO1QPRLB184XYHV7HWmItYGT Qz5VnhfLDANCVv5HLfwytZ+FcIbeTm5l9IRjcdhtgNrJ6PAQAjbkZHsdT8EdHgQlVDPo pjZzHUTkK7RYiPGlMni5BTlf5qOf+Yw+v+VjiNRloY+FNG+92gOX7RfCO/thh5bylQ+r I5b7JjQ41DIxturiaj02w60un95+YkTYx9egOfR4xTKD63f1dniKEd6U84HAdZye+zwW eCLo3SagjfJtgMkWLw/KLnmVKMFFdcApDODmiz5LMFlFx1QRMuFnGANAf5yRMu1nXUTn 2hDQ== X-Received: by 10.140.34.168 with SMTP id l37mr974347qgl.20.1426586075272; Tue, 17 Mar 2015 02:54:35 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: rtc-linux@googlegroups.com Received: by 10.140.38.213 with SMTP id t79ls30225qgt.98.gmail; Tue, 17 Mar 2015 02:54:35 -0700 (PDT) X-Received: by 10.52.186.7 with SMTP id fg7mr46516768vdc.0.1426586075090; Tue, 17 Mar 2015 02:54:35 -0700 (PDT) Received: from mailout4.w1.samsung.com (mailout4.w1.samsung.com. [210.118.77.14]) by gmr-mx.google.com with ESMTPS id l3si2453970pdo.0.2015.03.17.02.54.34 for (version=TLSv1 cipher=RC4-MD5 bits=128/128); Tue, 17 Mar 2015 02:54:35 -0700 (PDT) Received-SPF: none (google.com: k.kozlowski@samsung.com does not designate permitted sender hosts) client-ip=210.118.77.14; Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NLC00B7VP1GEZ20@mailout4.w1.samsung.com> for rtc-linux@googlegroups.com; Tue, 17 Mar 2015 09:58:28 +0000 (GMT) X-AuditID: cbfec7f4-b7f126d000001e9a-5b-5507f94586bb Received: from eusync4.samsung.com ( [203.254.199.214]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id ED.AE.07834.549F7055; Tue, 17 Mar 2015 09:52:05 +0000 (GMT) Received: from AMDC1943.digital.local ([106.116.151.171]) by eusync4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0NLC00IBHOURM790@eusync4.samsung.com>; Tue, 17 Mar 2015 09:54:30 +0000 (GMT) From: Krzysztof Kozlowski To: Sangbeom Kim , Samuel Ortiz , Lee Jones , Alessandro Zummo , linux-kernel@vger.kernel.org, rtc-linux@googlegroups.com, linux-samsung-soc@vger.kernel.org Cc: Kyungmin Park , Marek Szyprowski , Chanwoo Choi , Krzysztof Kozlowski Subject: [rtc-linux] [PATCH v2 1/2] rtc: s5m: Allow usage on device type different than main MFD type Date: Tue, 17 Mar 2015 10:54:17 +0100 Message-id: <1426586058-15987-1-git-send-email-k.kozlowski@samsung.com> X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrGJMWRmVeSWpSXmKPExsVy+t/xa7quP9lDDU6eULRYcvEqu8X1L89Z LV6/MLQ42/SG3eL+16OMFpd3zWGzmHF+H5PF2iN32S32d3YwWpzuZrW4uOILkwO3x56JJ9k8 7lzbw+Yx72SgR9+WVYwe0+f9ZPL4vEkugC2KyyYlNSezLLVI3y6BK+Pfqe8sBfOFKlbeucHe wPiXr4uRk0NCwERiwpd9TBC2mMSFe+vZuhi5OIQEljJKLP3zDsrpY5KYcaGFFaSKTcBYYvPy JWAJEYFfjBL9F78zgzjMAlsZJXomfmEGqRIWiJZ4fvYTmM0ioCoxecpEdhCbV8Bd4u7sNlaI fXISJ49NZp3AyL2AkWEVo2hqaXJBcVJ6rqFecWJucWleul5yfu4mRkhYfdnBuPiY1SFGAQ5G JR7ehjz2UCHWxLLiytxDjBIczEoivPfeAoV4UxIrq1KL8uOLSnNSiw8xMnFwSjUwRjmGZtRq iJrGv5nBpnJNcCXH5Sfq9938AnfJqfQ9XvFwzdfLm20vOta8UivYxnB4wgPd5vOWm9icJy5M /BrYymjSz73Reo9Wqmjo7LC+qvN3l82aKPtiQmYBe9ycc6/X3/MQZZuSteDBt+9rnzCfe9Lg dnybSc3DTR84j3IarexWmsjLa6N+XomlOCPRUIu5qDgRAGdm/PMJAgAA X-Original-Sender: k.kozlowski@samsung.com X-Original-Authentication-Results: gmr-mx.google.com; spf=none (google.com: k.kozlowski@samsung.com does not designate permitted sender hosts) smtp.mail=k.kozlowski@samsung.com Reply-To: rtc-linux@googlegroups.com Precedence: list Mailing-list: list rtc-linux@googlegroups.com; contact rtc-linux+owners@googlegroups.com List-ID: X-Google-Group-Id: 712029733259 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , The RTC driver supports two flavors of S5M devices: S5M8767-like and S2MPS14-like. On S2MPS13 and S2MPS14 devices the RTC module is the same so we want to re-use the existing support of S2MPS14. However device type was passed from parent MFD driver in platform data structure. This way for the S2MPS13 device the main MFD driver passed device type of 'S2MPS13X'. Instead decouple detecting of device type between main MFD and RTC driver. This allows adding support for other S2MPS14 variations (like S2MPS11 and S2MPS13) easily by adding to mfd/sec-core.c: static const struct mfd_cell s2mps13_devs[] = { { .name = "s2mps14-rtc", } }; Signed-off-by: Krzysztof Kozlowski --- Changes since v1: 1. Consistently use platform_get_device_id() instead of pdev->id_entry. --- drivers/rtc/rtc-s5m.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/rtc/rtc-s5m.c b/drivers/rtc/rtc-s5m.c index 4008b84246ca..1f15b67da232 100644 --- a/drivers/rtc/rtc-s5m.c +++ b/drivers/rtc/rtc-s5m.c @@ -90,7 +90,7 @@ struct s5m_rtc_info { struct regmap *regmap; struct rtc_device *rtc_dev; int irq; - int device_type; + enum sec_device_type device_type; int rtc_24hr_mode; const struct s5m_rtc_reg_config *regs; }; @@ -650,7 +650,7 @@ static int s5m_rtc_probe(struct platform_device *pdev) if (!info) return -ENOMEM; - switch (pdata->device_type) { + switch (platform_get_device_id(pdev)->driver_data) { case S2MPS14X: regmap_cfg = &s2mps14_rtc_regmap_config; info->regs = &s2mps_rtc_regs; @@ -667,7 +667,9 @@ static int s5m_rtc_probe(struct platform_device *pdev) alarm_irq = S5M8767_IRQ_RTCA1; break; default: - dev_err(&pdev->dev, "Device type is not supported by RTC driver\n"); + dev_err(&pdev->dev, + "Device type %lu is not supported by RTC driver\n", + platform_get_device_id(pdev)->driver_data); return -ENODEV; } @@ -687,7 +689,7 @@ static int s5m_rtc_probe(struct platform_device *pdev) info->dev = &pdev->dev; info->s5m87xx = s5m87xx; - info->device_type = s5m87xx->device_type; + info->device_type = platform_get_device_id(pdev)->driver_data; if (s5m87xx->irq_data) { info->irq = regmap_irq_get_virq(s5m87xx->irq_data, alarm_irq);