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: 6030531 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5E9A3BF90F for ; Tue, 17 Mar 2015 09:55:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B46B52045B for ; Tue, 17 Mar 2015 09:55:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BF69820426 for ; Tue, 17 Mar 2015 09:55:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753696AbbCQJyj (ORCPT ); Tue, 17 Mar 2015 05:54:39 -0400 Received: from mailout4.w1.samsung.com ([210.118.77.14]:46698 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934617AbbCQJyd (ORCPT ); Tue, 17 Mar 2015 05:54:33 -0400 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>; 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: [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 Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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);