public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Chanwoo Choi <cw00.choi@samsung.com>
To: Guenter Roeck <groeck@google.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
	myungjoo.ham@samsung.com, Chris Zhong <zyw@rock-chips.com>,
	Guenter Roeck <groeck@chromium.org>,
	"Chanwoo Choi (chanwoo@kernel.org)" <chanwoo@kernel.org>,
	"cpgs (cpgs@samsung.com)" <cpgs@samsung.com>
Subject: Re: [PATCH v2 2/6] extcon: Add the support for extcon property according to extcon type
Date: Tue, 02 Aug 2016 10:27:47 +0900	[thread overview]
Message-ID: <579FF713.2030606@samsung.com> (raw)
In-Reply-To: <CABXOdTe=CbPvFNzxG1-b6ja3YFgXOx2MmecO6qFgqU1ttsgtdQ@mail.gmail.com>

Hi Guenter,

On 2016년 08월 02일 04:48, Guenter Roeck wrote:
> On Sun, Jul 31, 2016 at 10:50 PM, Chanwoo Choi <cw00.choi@samsung.com> wrote:
>> This patch support the extcon property for the external connector
>> because each external connector might have the property according to
>> the H/W design and the specific characteristics.
>>
>> - EXTCON_PROP_USB_[property name]
>> - EXTCON_PROP_CHG_[property name]
>> - EXTCON_PROP_JACK_[property name]
>> - EXTCON_PROP_DISP_[property name]
>>
>> Add the new extcon APIs to get/set the property value as following:
>> - int extcon_get_property(struct extcon_dev *edev, unsigned int id,
>>                         unsigned int prop,
>>                         union extcon_property_value *prop_val)
>> - int extcon_set_property(struct extcon_dev *edev, unsigned int id,
>>                         unsigned int prop,
>>                         union extcon_property_value prop_val)
>>
>> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
>> Tested-by: Chris Zhong <zyw@rock-chips.com>
> 
> Reviewed-by: Guenter Roeck <groeck@chromium.org>
> 
> [ couple of nitpicks below ]
> 
>> ---
>>  drivers/extcon/extcon.c | 201 +++++++++++++++++++++++++++++++++++++++++++++++-
>>  include/linux/extcon.h  |  86 +++++++++++++++++++++
>>  2 files changed, 286 insertions(+), 1 deletion(-)
>>

[snip]

>>  static ssize_t state_show(struct device *dev, struct device_attribute *attr,
>>                           char *buf)
>>  {
>> @@ -421,7 +475,7 @@ int extcon_get_cable_state_(struct extcon_dev *edev, const unsigned int id)
>>         if (edev->max_supported && edev->max_supported <= index)
>>                 return -EINVAL;
>>
>> -       return !!(edev->state & (1 << index));
>> +       return (int)(is_extcon_attached(edev, index));
> 
> Conversion from bool to int (0, 1) is automatic, so
> 
>         return is_extcon_attached(edev, index);
> 
> would be identical.

OK. I'll fix it.

[snip]

>> diff --git a/include/linux/extcon.h b/include/linux/extcon.h
>> index 46d802892c82..5a97e52abefb 100644
>> --- a/include/linux/extcon.h
>> +++ b/include/linux/extcon.h
>> @@ -77,6 +77,68 @@
>>
>>  #define EXTCON_NUM             63
>>
>> +/*
>> + * Define the property of supported external connectors.
>> + *
>> + * When adding the new extcon property, they *must* have
>> + * the type/value/default information. Also, you *have to*
>> + * modify the EXTCON_PROP_[type]_START/END definitions
>> + * which mean the range of the supported properties
>> + * for each extcon type.
>> + *
>> + * The naming style of property
>> + * : EXTCON_PROP_[type]_[property name]
>> + *
>> + * EXTCON_PROP_USB_[property name]     : USB property
>> + * EXTCON_PROP_CHG_[property name]     : Charger property
>> + * EXTCON_PROP_JACK_[property name]    : Jack property
>> + * EXTCON_PROP_DISP_[property name]    : Display property
>> + */
>> +
>> +/*
>> + * Properties of EXTCON_TYPE_USB.
>> + *
>> + * - EXTCON_PROP_USB_ID
>> + * @type:      integer (intval)
>> + * @value:     0 (low) or 1 (high)
>> + * @default:   0 (low)
>> + * - EXTCON_PROP_USB_VBUS
>> + * @type:      integer (intval)
>> + * @value:     0 (low) or 1 (high)
>> + * @default:   0 (low)
>> + */
>> +#define EXTCON_PROP_USB_ID             0
>> +#define EXTCON_PROP_USB_VBUS           1
>> +
>> +#define EXTCON_PROP_USB_MIN            0
>> +#define EXTCON_PROP_USB_MAX            1
>> +#define EXTCON_PROP_USB_CNT    (EXTCON_PROP_USB_MAX - EXTCON_PROP_USB_MIN + 1)
>> +
>> +/* Properties of EXTCON_TYPE_CHG. */
>> +#define EXTCON_PROP_CHG_MIN            50
>> +#define EXTCON_PROP_CHG_MAX            50
>> +#define EXTCON_PROP_CHG_CNT    (EXTCON_PROP_CHG_MAX - EXTCON_PROP_CHG_MIN + 1)
>> +
>> +/* Properties of EXTCON_TYPE_JACK. */
>> +#define EXTCON_PROP_JACK_MIN           100
>> +#define EXTCON_PROP_JACK_MAX           100
>> +#define EXTCON_PROP_JACK_CNT (EXTCON_PROP_JACK_MAX - EXTCON_PROP_JACK_MIN + 1)
>> +
>> +/* Properties of EXTCON_TYPE_DISP. */
>> +#define EXTCON_PROP_DISP_MIN           150
>> +#define EXTCON_PROP_DISP_MAX           150
>> +#define EXTCON_PROP_DISP_CNT (EXTCON_PROP_DISP_MAX - EXTCON_PROP_DISP_MIN + 1)
>> +
>> +/*
>> + * Define the type of property's value.
>> + *
>> + * Define the property's value as union type. Because each property
>> + * would need the different data type to store it.
>> + */
>> +union extcon_property_value {
>> +       int intval;     /* type : interger (intval) */
> 
> integer

OK. I'll fix it.

Thanks for review.

Regards,
Chanwoo Choi

  reply	other threads:[~2016-08-02  9:47 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-01  5:50 [PATCH v2 0/6] extcon: Add the support for extcon type and property Chanwoo Choi
2016-08-01  5:50 ` [PATCH v2 1/6] extcon: Add the extcon_type to gather each connector into five category Chanwoo Choi
2016-08-01 19:44   ` Guenter Roeck
2016-08-01  5:50 ` [PATCH v2 2/6] extcon: Add the support for extcon property according to extcon type Chanwoo Choi
2016-08-01 19:48   ` Guenter Roeck
2016-08-02  1:27     ` Chanwoo Choi [this message]
2016-08-01  5:50 ` [PATCH v2 3/6] extcon: Add the support for the capability of each property Chanwoo Choi
2016-08-01 19:49   ` Guenter Roeck
2016-08-01  5:50 ` [PATCH v2 4/6] extcon: Rename the extcon_set/get_state() to maintain the function naming pattern Chanwoo Choi
2016-08-01 19:51   ` Guenter Roeck
2016-08-01  5:50 ` [PATCH v2 5/6] extcon: Add the synchronization extcon APIs to support the notification Chanwoo Choi
2016-08-01 19:55   ` Guenter Roeck
2016-08-02  1:50     ` Chanwoo Choi
2016-08-01  5:50 ` [PATCH v2 6/6] extcon: Add EXTCON_DISP_DP and the property for USB Type-C Chanwoo Choi
2016-08-01 18:18 ` [PATCH v2 0/6] extcon: Add the support for extcon type and property Guenter Roeck
2016-08-02  1:52   ` Chanwoo Choi
2016-08-02  4:51     ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=579FF713.2030606@samsung.com \
    --to=cw00.choi@samsung.com \
    --cc=chanwoo@kernel.org \
    --cc=cpgs@samsung.com \
    --cc=groeck@chromium.org \
    --cc=groeck@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=myungjoo.ham@samsung.com \
    --cc=zyw@rock-chips.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox