From mboxrd@z Thu Jan 1 00:00:00 1970 From: Beomho Seo Subject: Re: [PATCH 1/3] power: max17042_battery: Use reg type instead of chip type Date: Wed, 01 Apr 2015 18:00:44 +0900 Message-ID: <551BB3BC.8030501@samsung.com> References: <1427808574-19397-1-git-send-email-beomho.seo@samsung.com> <1427808574-19397-2-git-send-email-beomho.seo@samsung.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Return-path: Received: from mailout2.samsung.com ([203.254.224.25]:27961 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750726AbbDAJAr (ORCPT ); Wed, 1 Apr 2015 05:00:47 -0400 In-reply-to: Sender: linux-pm-owner@vger.kernel.org List-Id: linux-pm@vger.kernel.org To: Krzysztof Kozlowski Cc: linux-kernel@vger.kernel.org, cw00.choi@samsung.com, sangbae90.lee@samsung.com, inki.dae@samsung.com, linux-pm@vger.kernel.org, myungjoo.ham@samsung.com, Sebastian Reichel , jonghwa3.lee@samsung.comlinux-pm@vger.kernel.org, beomho.seo@samsung.com On 04/01/2015 05:18 PM, Krzysztof Kozlowski wrote: > 2015-03-31 15:29 GMT+02:00 Beomho Seo : >> Currently, max17042 battery driver choose register map by MAX17042_DevName >> register. But thid register is return IC specific firmware version. So other >> maxim chip hard to use this drvier. This patch choose reg_type by driver_data. > > I don't quite get the concept of "reg_type" and why it replaces chip > type? It seems that you choose reg_type based on given chip type so > there is direct mapping chip_type->reg_type. If max17047 and max17050 > are the same from the point of view of interface (registers) then they > should use the same compatible or the same device type. Something > like: > When I check datasheet, MAX17042_DevName register return Firmware version. Firmware version not chip type. For use other maxim chip, be better use of_id->data or id->driver_data(be like other maxim mfd driver) I will remove reg_type. and chip_type will be assigned through of_id->data or id->driver_data. >> static const struct i2c_device_id max17042_id[] = { >> - { "max17042", 0 }, >> - { "max17047", 1 }, >> - { "max17050", 2 }, >> + { "max17042", MAXIM_DEVICE_TYPE_MAX17042 }, >> + { "max17047", MAXIM_DEVICE_TYPE_MAX17047 }, >> + { "max17050", MAXIM_DEVICE_TYPE_MAX17047 }, /* Same as 17047 */ >> { } > > So why you are adding the conversion from i2c_device_id -> reg_type? > > Beside that, thanks for integrating this into existing driver! Much appreciated. > > Best regards, > Krzysztof > Best regards, Beomho From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753191AbbDAJAv (ORCPT ); Wed, 1 Apr 2015 05:00:51 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:27961 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750726AbbDAJAr (ORCPT ); Wed, 1 Apr 2015 05:00:47 -0400 X-AuditID: cbfee68e-f79b46d000002b74-9f-551bb3bddd06 Message-id: <551BB3BC.8030501@samsung.com> Date: Wed, 01 Apr 2015 18:00:44 +0900 From: Beomho Seo User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-version: 1.0 To: Krzysztof Kozlowski Cc: linux-kernel@vger.kernel.org, cw00.choi@samsung.com, sangbae90.lee@samsung.com, inki.dae@samsung.com, linux-pm@vger.kernel.org, myungjoo.ham@samsung.com, Sebastian Reichel , jonghwa3.lee@samsung.com, linux-pm@vger.kernel.org, beomho.seo@samsung.com Subject: Re: [PATCH 1/3] power: max17042_battery: Use reg type instead of chip type References: <1427808574-19397-1-git-send-email-beomho.seo@samsung.com> <1427808574-19397-2-git-send-email-beomho.seo@samsung.com> In-reply-to: Content-type: text/plain; charset=utf-8 Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrCIsWRmVeSWpSXmKPExsWyRsSkRHfvZulQg/uXuCxOf9rGbnH9y3NW i0n3J7BYdJ59wmzx+oWhxeVdc9gsPvceYbS43biCzeL4p4MsFqd3lzhweWxa1cnm0bdlFaPH 501yAcxRXDYpqTmZZalF+nYJ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6 Tz4A62ARUJVYs2oHE4jNJqAp8X7KFaAaDg5RgQiJ25c5IcoFJX5MvgfWKiJgKHFw93YmkJnM ApOYJNb2/2MCqRcWCJWYsDUeYtcpRondK3+AzeQUCJb4fvAOWA2zgLrElCm5IGFmAXmJzWve Mk9gFJiFZMUshKpZSKoWMDKvYhRNLUguKE5KzzXSK07MLS7NS9dLzs/dxAiO62fSOxhXNVgc YhTgYFTi4dWMkA4VYk0sK67MPcQowcGsJMJrvAgoxJuSWFmVWpQfX1Sak1p8iNEU6P+JzFKi yfnAlJNXEm9obGJmZGlkbmhhZGyuJM6rZN8WIiSQnliSmp2aWpBaBNPHxMEp1cC45LbwVvVN Rj9mnI7dHP/WovWGzJapJ7iZ5/5M6CnV6Hy1a4rZ6Vk7Hv1YXrly48UnW70WfX40ZVIqg5a6 8hRhJhfWw3dqghJmflH3/5k72yra2+7R9+XTRYXj59v9/bkulXvJtYhVywRdDZ+ziWef+vbv X8PaR2HJ272Ol7NnKVUtOLZf96/WJiWW4oxEQy3mouJEAFcYCswBAwAA DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/01/2015 05:18 PM, Krzysztof Kozlowski wrote: > 2015-03-31 15:29 GMT+02:00 Beomho Seo : >> Currently, max17042 battery driver choose register map by MAX17042_DevName >> register. But thid register is return IC specific firmware version. So other >> maxim chip hard to use this drvier. This patch choose reg_type by driver_data. > > I don't quite get the concept of "reg_type" and why it replaces chip > type? It seems that you choose reg_type based on given chip type so > there is direct mapping chip_type->reg_type. If max17047 and max17050 > are the same from the point of view of interface (registers) then they > should use the same compatible or the same device type. Something > like: > When I check datasheet, MAX17042_DevName register return Firmware version. Firmware version not chip type. For use other maxim chip, be better use of_id->data or id->driver_data(be like other maxim mfd driver) I will remove reg_type. and chip_type will be assigned through of_id->data or id->driver_data. >> static const struct i2c_device_id max17042_id[] = { >> - { "max17042", 0 }, >> - { "max17047", 1 }, >> - { "max17050", 2 }, >> + { "max17042", MAXIM_DEVICE_TYPE_MAX17042 }, >> + { "max17047", MAXIM_DEVICE_TYPE_MAX17047 }, >> + { "max17050", MAXIM_DEVICE_TYPE_MAX17047 }, /* Same as 17047 */ >> { } > > So why you are adding the conversion from i2c_device_id -> reg_type? > > Beside that, thanks for integrating this into existing driver! Much appreciated. > > Best regards, > Krzysztof > Best regards, Beomho