RE: [PATCH 1/2] ACPICA: adapt buffer length for Field Attrib Raw Process in Ops Region

2016-07-31 Thread Zheng, Lv
Hi,

> From: Benjamin Tissoires [mailto:benjamin.tissoi...@redhat.com]
> Subject: [PATCH 1/2] ACPICA: adapt buffer length for Field Attrib Raw
> Process in Ops Region
> 
> Detected on the Surface 3:
> The MSHW0011 driver uses Field Attrib Raw Process to return information
> for the ACPI Battery. The DSDT declares a parameter of 2 though
> functions like _BST or _BIX require a much bigger out buffer.
> 
> It looks like the incoming buffer has the requested size and we can
> work around the issue by using this input size as the output and
> parameters size.
> 
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=106231
> 
> Signed-off-by: Benjamin Tissoires 
> ---
>  drivers/acpi/acpica/exfield.c | 11 +++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/acpi/acpica/exfield.c b/drivers/acpi/acpica/exfield.c
> index d7d3ee3..a1bd041 100644
> --- a/drivers/acpi/acpica/exfield.c
> +++ b/drivers/acpi/acpica/exfield.c
> @@ -413,6 +413,17 @@ acpi_ex_write_data_to_field(union
> acpi_operand_object *source_desc,
>* Data[x-1]: (Bytes 2-x of the arbitrary length
> data buffer)
>*/
>   length += 2;
> +
> + /*
> +  * When using Field Attrib Raw Process, it looks like
> +  * the parameter access_length can be wrong and
> the
> +  * required output buffer can be much bigger.
> +  * So just take the incoming buffer length as the
> +  * reference.
> +  */
> + if (accessor_type ==
> AML_FIELD_ATTRIB_RAW_PROCESS)
> + length = source_desc->buffer.length;
> +
[Lv Zheng] 
I think the related code is:

OperationRegion (OR02, GenericSerialBus, Zero, 0x0100)
Field (OR02, BufferAcc, NoLock, Preserve)
{
Connection (BX00), 
AccessAs (BufferAcc, AttribRawProcessBytes (0x02)), 
BB00,   8
}
Name (SPB0, Buffer (0x80) {})
CreateByteField (SPB0, Zero, STA2)
CreateByteField (SPB0, One, LEN0)
CreateByteField (SPB0, 0x02, CMD0)
CreateByteField (SPB0, 0x03, DAT0)
CreateByteField (SPB0, 0x04, DAT1)
CreateDWordField (SPB0, 0x05, DAT2)
CreateField (SPB0, 0x10, 0x0320, DAT3)
Method (RSPB, 3, NotSerialized)
{
CMD0 = One
LEN0 = 0x08
DAT0 = Arg0
DAT1 = Arg1
DAT2 = Arg2
SPB0 = ^^I2Z1.BB00 = SPB0 /* \_SB_.BAT0.SPB0 */
...
}
And we have confirmed that the iASL disassembly result is correct.

Then this issue is not a parser issue, but looks like an issue either in 
interpreter or in BIOS as:

1. The following line triggers i2c operation region handlers:
SPB0 = ^^I2Z1.BB00 = SPB0
Where:
SPB0 is sized as 0x80, BB00 is sized as 0x02.
And in spec 19.6.1 AccessAs (Change Field Unit Access), it is said that 
AttribRawProcessBytes(AccessLength) requires an AccessLength parameter.
However in this case, the length of the output buffer is not correct, much 
smaller than the container buffer.
So this firstly looks like a BIOS issue. And then needn't be fixed in OS.
2. If this is not a BIOS bug but an interpreter bug, then SPB0 should be a 
buffer passing to the i2c region handler.
The bug should be something related to "data type conversion".
Please refer to:
19.2.5.4 Implicit Source Operand Conversion
19.2.5.5 Implicit Result Object Conversion
It looks like that we have troubles in either 1st Store or 2nd Store.
If so, it seems we shouldn't fix this issue here. And thus this fix also 
looks invalid.

IMO (may be wrong), this bug finally may cause dissension among different 
parties (BIOS, Windows, ACPICA, spec).

However, for the time being, is that possible to work this issue around in the 
i2c operation region driver?

Thanks and best regards
-Lv


>   function = ACPI_WRITE | (accessor_type << 16);
>   } else {/* IPMI */
> 
> --
> 2.5.5



RE: [PATCH 1/2] ACPICA: adapt buffer length for Field Attrib Raw Process in Ops Region

2016-07-31 Thread Zheng, Lv
Hi,

> From: Benjamin Tissoires [mailto:benjamin.tissoi...@redhat.com]
> Subject: [PATCH 1/2] ACPICA: adapt buffer length for Field Attrib Raw
> Process in Ops Region
> 
> Detected on the Surface 3:
> The MSHW0011 driver uses Field Attrib Raw Process to return information
> for the ACPI Battery. The DSDT declares a parameter of 2 though
> functions like _BST or _BIX require a much bigger out buffer.
> 
> It looks like the incoming buffer has the requested size and we can
> work around the issue by using this input size as the output and
> parameters size.
> 
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=106231
> 
> Signed-off-by: Benjamin Tissoires 
> ---
>  drivers/acpi/acpica/exfield.c | 11 +++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/acpi/acpica/exfield.c b/drivers/acpi/acpica/exfield.c
> index d7d3ee3..a1bd041 100644
> --- a/drivers/acpi/acpica/exfield.c
> +++ b/drivers/acpi/acpica/exfield.c
> @@ -413,6 +413,17 @@ acpi_ex_write_data_to_field(union
> acpi_operand_object *source_desc,
>* Data[x-1]: (Bytes 2-x of the arbitrary length
> data buffer)
>*/
>   length += 2;
> +
> + /*
> +  * When using Field Attrib Raw Process, it looks like
> +  * the parameter access_length can be wrong and
> the
> +  * required output buffer can be much bigger.
> +  * So just take the incoming buffer length as the
> +  * reference.
> +  */
> + if (accessor_type ==
> AML_FIELD_ATTRIB_RAW_PROCESS)
> + length = source_desc->buffer.length;
> +
[Lv Zheng] 
I think the related code is:

OperationRegion (OR02, GenericSerialBus, Zero, 0x0100)
Field (OR02, BufferAcc, NoLock, Preserve)
{
Connection (BX00), 
AccessAs (BufferAcc, AttribRawProcessBytes (0x02)), 
BB00,   8
}
Name (SPB0, Buffer (0x80) {})
CreateByteField (SPB0, Zero, STA2)
CreateByteField (SPB0, One, LEN0)
CreateByteField (SPB0, 0x02, CMD0)
CreateByteField (SPB0, 0x03, DAT0)
CreateByteField (SPB0, 0x04, DAT1)
CreateDWordField (SPB0, 0x05, DAT2)
CreateField (SPB0, 0x10, 0x0320, DAT3)
Method (RSPB, 3, NotSerialized)
{
CMD0 = One
LEN0 = 0x08
DAT0 = Arg0
DAT1 = Arg1
DAT2 = Arg2
SPB0 = ^^I2Z1.BB00 = SPB0 /* \_SB_.BAT0.SPB0 */
...
}
And we have confirmed that the iASL disassembly result is correct.

Then this issue is not a parser issue, but looks like an issue either in 
interpreter or in BIOS as:

1. The following line triggers i2c operation region handlers:
SPB0 = ^^I2Z1.BB00 = SPB0
Where:
SPB0 is sized as 0x80, BB00 is sized as 0x02.
And in spec 19.6.1 AccessAs (Change Field Unit Access), it is said that 
AttribRawProcessBytes(AccessLength) requires an AccessLength parameter.
However in this case, the length of the output buffer is not correct, much 
smaller than the container buffer.
So this firstly looks like a BIOS issue. And then needn't be fixed in OS.
2. If this is not a BIOS bug but an interpreter bug, then SPB0 should be a 
buffer passing to the i2c region handler.
The bug should be something related to "data type conversion".
Please refer to:
19.2.5.4 Implicit Source Operand Conversion
19.2.5.5 Implicit Result Object Conversion
It looks like that we have troubles in either 1st Store or 2nd Store.
If so, it seems we shouldn't fix this issue here. And thus this fix also 
looks invalid.

IMO (may be wrong), this bug finally may cause dissension among different 
parties (BIOS, Windows, ACPICA, spec).

However, for the time being, is that possible to work this issue around in the 
i2c operation region driver?

Thanks and best regards
-Lv


>   function = ACPI_WRITE | (accessor_type << 16);
>   } else {/* IPMI */
> 
> --
> 2.5.5



[PATCH v2 0/6] extcon: Add the support for extcon type and property

2016-07-31 Thread Chanwoo Choi
This patch-set add the support the extcon type, extcon property
and the synchronization functions.

The each external connector has the common characters. So, the external
connectors are able to gather in the specific type. And the each external
connectors has the specific H/W desigin to support the multiple features
throught h/w lines. There are the requirement to express the each h/w
character of each external connector. Lastly, when the state and property
are changed, the extcon notify the extcon client driver of the changed
information. To support the notification on extcon provider drivers,
this patches support the three sync functions.

Changes from v1:
- Expand the size (+1) of the property array for each extcon type.
- Use the memset() to initialize the property when connector is detached.
- Wrap the data of struct extcon_dev in the lock mechanism.
- Don't send the notification if connector state is not changed in
  extcon_set_state_sync()
- Fix the minor issue.
- Add Tested-by tag of Chris Zhong for these patches.
- Add Signed-off tag of Myungjoo Ham for patch1.
- Add Reviewed-by tag of Guenter Roeck for patch6.

Depends on:
This patch depend on the extcon git repository[2]. (branch : extcon-next)

[1] https://en.wikipedia.org/wiki/DisplayPort
[2] https://git.kernel.org/cgit/linux/kernel/git/chanwoo/extcon.git/

[Detailed description of these patches]
1. Add the extcon type to group the each external connector.
There are five categories unitl now as following:
- EXTCON_TYPE_USB  : USB connector
- EXTCON_TYPE_CHG  : Charger connector
- EXTCON_TYPE_JACK : Jack connector
- EXTCON_TYPE_DISP : Display connector
- EXTCON_TYPE_MISC : Miscellaneous connector

2. Add the extcon property to support the multiple characteristic
for the specific H/W design.
- EXTCON_PROP_USB_[property name]
- EXTCON_PROP_CHG_[property name]
- EXTCON_PROP_JACK_[property name]
- EXTCON_PROP_DISP_[property name]
e.g., EXTCON_PROP_USB_ID and EXTCON_PROP_USB_VBUS
The list of the new extcon APIs for the property 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)
- int extcon_get_property_capability(struct extcon_dev *edev,
unsigned int id, unsigned int prop);
- int extcon_set_property_capability(struct extcon_dev *edev,
unsigned int id, unsigned int prop);

3. Add the sync functions to synchronize the data of each external connector
between an extcon provider driver and the extcon client drivers.
The list of the new extcon sync APIs as following:
- extcon_sync() : Send the notification for each external connector to
synchronize the information between and extcon provider driver
and the extcon client drivers.
- extcon_set_state_sync() : Set the state of external connector with noti.
- extcon_set_property_sync() : Set the property of external connector with noti.

4. Add the new external connector definition. The EXTCON_DISP_DP
means the Display external connector[1].
The list of new external connector as following:
- EXTCON_DISP_DP
The list of new property of USB connector as following:
- EXTCON_PROP_USB_TYPEC_POLARITY

5. Rename the renames the existing extcon_get/set_cable_state_()
to maintain the function naming pattern like as extcon APIs for property.
- extcon_set_cable_state_() -> extcon_set_state()
- extcon_get_cable_state_() -> extcon_get_state()

For example,
case 1, change the state of external connector and synchronized the data.
extcon_set_state_sync(edev, EXTCON_USB, 1);
case 2, change both the state and property of external connector
and synchronized the data.
extcon_set_state(edev, EXTCON_USB, 1);
extcon_set_property(edev, EXTCON_USB, EXTCON_PROP_USB_ID, 1);
extcon_set_property(edev, EXTCON_USB, EXTCON_PROP_USB_VBUS, 0);
extcon_sync(edev, EXTCON_USB);
case 3, change the property of external connector and synchronized the data.
extcon_set_property(edev, EXTCON_USB, EXTCON_PROP_USB_VBUS, 0);
extcon_set_property(edev, EXTCON_USB, EXTCON_PROP_USB_ID, 1);
extcon_sync(edev, EXTCON_USB);
case 4, change the property of external connector and synchronized the data.
extcon_set_property_sync(edev, EXTCON_USB, EXTCON_PROP_USB_VBUS, 0);


Chanwoo Choi (5):
  extcon: Add the extcon_type to gather each connector into five category
  extcon: Add the support for extcon property according to extcon type
  extcon: Add the support for the capability of each property
  extcon: Rename the extcon_set/get_state() to maintain the function naming 
pattern
  extcon: Add the synchronization extcon APIs to support the notification

Chris Zhong (1):
  extcon: Add EXTCON_DISP_DP and the 

[PATCH v2 3/6] extcon: Add the support for the capability of each property

2016-07-31 Thread Chanwoo Choi
This patch adds the support of the property capability setting. This function
decides the supported properties of each external connector on extcon provider
driver.

Ths list of new extcon APIs to get/set the capability of property as following:
- int extcon_get_property_capability(struct extcon_dev *edev,
unsigned int id, unsigned int prop);
- int extcon_set_property_capability(struct extcon_dev *edev,
unsigned int id, unsigned int prop);

Signed-off-by: Chanwoo Choi 
Tested-by: Chris Zhong 
---
 drivers/extcon/extcon.c | 141 
 include/linux/extcon.h  |  22 
 2 files changed, 163 insertions(+)

diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
index 4027aee08ce5..10b201b161ac 100644
--- a/drivers/extcon/extcon.c
+++ b/drivers/extcon/extcon.c
@@ -201,6 +201,11 @@ struct extcon_cable {
union extcon_property_value chg_propval[EXTCON_PROP_CHG_CNT];
union extcon_property_value jack_propval[EXTCON_PROP_JACK_CNT];
union extcon_property_value disp_propval[EXTCON_PROP_DISP_CNT];
+
+   unsigned long usb_bits[BITS_TO_LONGS(EXTCON_PROP_USB_CNT)];
+   unsigned long chg_bits[BITS_TO_LONGS(EXTCON_PROP_CHG_CNT)];
+   unsigned long jack_bits[BITS_TO_LONGS(EXTCON_PROP_JACK_CNT)];
+   unsigned long disp_bits[BITS_TO_LONGS(EXTCON_PROP_DISP_CNT)];
 };
 
 static struct class *extcon_class;
@@ -297,6 +302,39 @@ static bool is_extcon_property_supported(unsigned int id, 
unsigned int prop)
return !!(extcon_info[id].type & type);
 }
 
+static int is_extcon_property_capability(struct extcon_dev *edev,
+   unsigned int id, int index,unsigned int prop)
+{
+   struct extcon_cable *cable;
+   int type, ret;
+
+   /* Check whether the property is supported or not. */
+   type = get_extcon_type(prop);
+   if (type < 0)
+   return type;
+
+   cable = >cables[index];
+
+   switch (type) {
+   case EXTCON_TYPE_USB:
+   ret = test_bit(prop - EXTCON_PROP_USB_MIN, cable->usb_bits);
+   break;
+   case EXTCON_TYPE_CHG:
+   ret = test_bit(prop - EXTCON_PROP_CHG_MIN, cable->chg_bits);
+   break;
+   case EXTCON_TYPE_JACK:
+   ret = test_bit(prop - EXTCON_PROP_JACK_MIN, cable->jack_bits);
+   break;
+   case EXTCON_TYPE_DISP:
+   ret = test_bit(prop - EXTCON_PROP_DISP_MIN, cable->disp_bits);
+   break;
+   default:
+   ret = -EINVAL;
+   }
+
+   return ret;
+}
+
 static void init_property(struct extcon_dev *edev, unsigned int id, int index)
 {
unsigned int type = extcon_info[id].type;
@@ -554,6 +592,12 @@ int extcon_get_property(struct extcon_dev *edev, unsigned 
int id,
 
spin_lock_irqsave(>lock, flags);
 
+   /* Check whether the property is available or not. */
+   if (!is_extcon_property_capability(edev, id, index, prop)) {
+   spin_unlock_irqrestore(>lock, flags);
+   return -EPERM;
+   }
+
/*
 * Check whether the external connector is attached.
 * If external connector is detached, the user can not
@@ -626,6 +670,12 @@ int extcon_set_property(struct extcon_dev *edev, unsigned 
int id,
 
spin_lock_irqsave(>lock, flags);
 
+   /* Check whether the property is available or not. */
+   if (!is_extcon_property_capability(edev, id, index, prop)) {
+   spin_unlock_irqrestore(>lock, flags);
+   return -EPERM;
+   }
+
cable = >cables[index];
 
/* Set the property value according to extcon type */
@@ -654,6 +704,97 @@ int extcon_set_property(struct extcon_dev *edev, unsigned 
int id,
 EXPORT_SYMBOL_GPL(extcon_set_property);
 
 /**
+ * extcon_get_property_capability() - Get the capability of property
+ * of an external connector.
+ * @edev:  the extcon device that has the cable.
+ * @id:the unique id of each external connector
+ * in extcon enumeration.
+ * @prop:  the property id among enum extcon_property.
+ *
+ * Returns 1 if the property is available or 0 if not available.
+ */
+int extcon_get_property_capability(struct extcon_dev *edev, unsigned int id,
+   unsigned int prop)
+{
+   int index;
+
+   if (!edev)
+   return -EINVAL;
+
+   /* Check whether the property is supported or not */
+   if (!is_extcon_property_supported(id, prop))
+   return -EINVAL;
+
+   /* Find the cable index of external connector by using id */
+   index = find_cable_index_by_id(edev, id);
+   if (index < 0)
+   return index;
+
+   return is_extcon_property_capability(edev, id, index, prop);
+}

[PATCH v2 5/6] extcon: Add the synchronization extcon APIs to support the notification

2016-07-31 Thread Chanwoo Choi
This patch adds the synchronization extcon APIs to support the notifications
for both state and property. When extcon_*_sync() functions is called,
the extcon informs the information from extcon provider to extcon client.

The extcon driver may need to change the both state and multiple properties
at the same time. After setting the data of a external connector,
the extcon send the notification to client driver with the extcon_*_sync().

The list of new extcon APIs as following:
- extcon_sync() : Send the notification for each external connector to
synchronize the information between extcon provider driver
and extcon client driver.
- extcon_set_state_sync() : Set the state of external connector with noti.
- extcon_set_property_sync() : Set the property of external connector with noti.

For example,
case 1, change the state of external connector and synchronized the data.
extcon_set_state_sync(edev, EXTCON_USB, 1);

case 2, change both the state and property of external connector
and synchronized the data.
extcon_set_state(edev, EXTCON_USB, 1);
extcon_set_property(edev, EXTCON_USB, EXTCON_PROP_USB_ID, 1);
extcon_sync(edev, EXTCON_USB);

case 3, change the property of external connector and synchronized the data.
extcon_set_property(edev, EXTCON_USB, EXTCON_PROP_USB_VBUS, 0);
extcon_set_property(edev, EXTCON_USB, EXTCON_PROP_USB_ID, 1);
extcon_sync(edev, EXTCON_USB);

case 4, change the property of external connector and synchronized the data.
extcon_set_property_sync(edev, EXTCON_USB, EXTCON_PROP_USB_VBUS, 0);

Signed-off-by: Chanwoo Choi 
Tested-by: Chris Zhong 
---
 drivers/extcon/extcon.c | 210 +++-
 include/linux/extcon.h  |  30 ++-
 2 files changed, 164 insertions(+), 76 deletions(-)

diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
index 207143347fb7..680246cceb62 100644
--- a/drivers/extcon/extcon.c
+++ b/drivers/extcon/extcon.c
@@ -279,14 +279,11 @@ static bool is_extcon_attached(struct extcon_dev *edev, 
unsigned int index)
return !!(edev->state & BIT(index));
 }
 
-static bool is_extcon_changed(u32 prev, u32 new, int idx, bool *attached)
+static bool is_extcon_changed(struct extcon_dev *edev, int index,
+   bool new_state)
 {
-   if (((prev >> idx) & 0x1) != ((new >> idx) & 0x1)) {
-   *attached = ((new >> idx) & 0x1) ? true : false;
-   return true;
-   }
-
-   return false;
+   int state = !!(edev->state & (1 << index));
+   return (state != new_state) ? true : false;
 }
 
 static bool is_extcon_property_supported(unsigned int id, unsigned int prop)
@@ -402,21 +399,13 @@ static ssize_t cable_state_show(struct device *dev,
 }
 
 /**
- * extcon_update_state() - Update the cable attach states of the extcon device
- *only for the masked bits.
- * @edev:  the extcon device
- * @mask:  the bit mask to designate updated bits.
- * @state: new cable attach status for @edev
- *
- * Changing the state sends uevent with environment variable containing
- * the name of extcon device (envp[0]) and the state output (envp[1]).
- * Tizen uses this format for extcon device to get events from ports.
- * Android uses this format as well.
+ * extcon_sync()   - Synchronize the states for both the attached/detached
+ * @edev:  the extcon device that has the cable.
  *
- * Note that the notifier provides which bits are changed in the state
- * variable with the val parameter (second) to the callback.
+ * This function send a notification to synchronize the all states of a
+ * specific external connector
  */
-static int extcon_update_state(struct extcon_dev *edev, u32 mask, u32 state)
+int extcon_sync(struct extcon_dev *edev, unsigned int id)
 {
char name_buf[120];
char state_buf[120];
@@ -425,73 +414,58 @@ static int extcon_update_state(struct extcon_dev *edev, 
u32 mask, u32 state)
int env_offset = 0;
int length;
int index;
+   int state;
unsigned long flags;
-   bool attached;
 
if (!edev)
return -EINVAL;
 
+   index = find_cable_index_by_id(edev, id);
+   if (index < 0)
+   return index;
+
spin_lock_irqsave(>lock, flags);
 
-   if (edev->state != ((edev->state & ~mask) | (state & mask))) {
-   u32 old_state;
+   state = !!(edev->state & (1 << index));
+   raw_notifier_call_chain(>nh[index], state, edev);
 
-   if (check_mutually_exclusive(edev, (edev->state & ~mask) |
-  (state & mask))) {
-   spin_unlock_irqrestore(>lock, flags);
-   return -EPERM;
-   }
+   /* This could be in interrupt handler */
+   prop_buf = (char 

[PATCH v2 0/6] extcon: Add the support for extcon type and property

2016-07-31 Thread Chanwoo Choi
This patch-set add the support the extcon type, extcon property
and the synchronization functions.

The each external connector has the common characters. So, the external
connectors are able to gather in the specific type. And the each external
connectors has the specific H/W desigin to support the multiple features
throught h/w lines. There are the requirement to express the each h/w
character of each external connector. Lastly, when the state and property
are changed, the extcon notify the extcon client driver of the changed
information. To support the notification on extcon provider drivers,
this patches support the three sync functions.

Changes from v1:
- Expand the size (+1) of the property array for each extcon type.
- Use the memset() to initialize the property when connector is detached.
- Wrap the data of struct extcon_dev in the lock mechanism.
- Don't send the notification if connector state is not changed in
  extcon_set_state_sync()
- Fix the minor issue.
- Add Tested-by tag of Chris Zhong for these patches.
- Add Signed-off tag of Myungjoo Ham for patch1.
- Add Reviewed-by tag of Guenter Roeck for patch6.

Depends on:
This patch depend on the extcon git repository[2]. (branch : extcon-next)

[1] https://en.wikipedia.org/wiki/DisplayPort
[2] https://git.kernel.org/cgit/linux/kernel/git/chanwoo/extcon.git/

[Detailed description of these patches]
1. Add the extcon type to group the each external connector.
There are five categories unitl now as following:
- EXTCON_TYPE_USB  : USB connector
- EXTCON_TYPE_CHG  : Charger connector
- EXTCON_TYPE_JACK : Jack connector
- EXTCON_TYPE_DISP : Display connector
- EXTCON_TYPE_MISC : Miscellaneous connector

2. Add the extcon property to support the multiple characteristic
for the specific H/W design.
- EXTCON_PROP_USB_[property name]
- EXTCON_PROP_CHG_[property name]
- EXTCON_PROP_JACK_[property name]
- EXTCON_PROP_DISP_[property name]
e.g., EXTCON_PROP_USB_ID and EXTCON_PROP_USB_VBUS
The list of the new extcon APIs for the property 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)
- int extcon_get_property_capability(struct extcon_dev *edev,
unsigned int id, unsigned int prop);
- int extcon_set_property_capability(struct extcon_dev *edev,
unsigned int id, unsigned int prop);

3. Add the sync functions to synchronize the data of each external connector
between an extcon provider driver and the extcon client drivers.
The list of the new extcon sync APIs as following:
- extcon_sync() : Send the notification for each external connector to
synchronize the information between and extcon provider driver
and the extcon client drivers.
- extcon_set_state_sync() : Set the state of external connector with noti.
- extcon_set_property_sync() : Set the property of external connector with noti.

4. Add the new external connector definition. The EXTCON_DISP_DP
means the Display external connector[1].
The list of new external connector as following:
- EXTCON_DISP_DP
The list of new property of USB connector as following:
- EXTCON_PROP_USB_TYPEC_POLARITY

5. Rename the renames the existing extcon_get/set_cable_state_()
to maintain the function naming pattern like as extcon APIs for property.
- extcon_set_cable_state_() -> extcon_set_state()
- extcon_get_cable_state_() -> extcon_get_state()

For example,
case 1, change the state of external connector and synchronized the data.
extcon_set_state_sync(edev, EXTCON_USB, 1);
case 2, change both the state and property of external connector
and synchronized the data.
extcon_set_state(edev, EXTCON_USB, 1);
extcon_set_property(edev, EXTCON_USB, EXTCON_PROP_USB_ID, 1);
extcon_set_property(edev, EXTCON_USB, EXTCON_PROP_USB_VBUS, 0);
extcon_sync(edev, EXTCON_USB);
case 3, change the property of external connector and synchronized the data.
extcon_set_property(edev, EXTCON_USB, EXTCON_PROP_USB_VBUS, 0);
extcon_set_property(edev, EXTCON_USB, EXTCON_PROP_USB_ID, 1);
extcon_sync(edev, EXTCON_USB);
case 4, change the property of external connector and synchronized the data.
extcon_set_property_sync(edev, EXTCON_USB, EXTCON_PROP_USB_VBUS, 0);


Chanwoo Choi (5):
  extcon: Add the extcon_type to gather each connector into five category
  extcon: Add the support for extcon property according to extcon type
  extcon: Add the support for the capability of each property
  extcon: Rename the extcon_set/get_state() to maintain the function naming 
pattern
  extcon: Add the synchronization extcon APIs to support the notification

Chris Zhong (1):
  extcon: Add EXTCON_DISP_DP and the 

[PATCH v2 3/6] extcon: Add the support for the capability of each property

2016-07-31 Thread Chanwoo Choi
This patch adds the support of the property capability setting. This function
decides the supported properties of each external connector on extcon provider
driver.

Ths list of new extcon APIs to get/set the capability of property as following:
- int extcon_get_property_capability(struct extcon_dev *edev,
unsigned int id, unsigned int prop);
- int extcon_set_property_capability(struct extcon_dev *edev,
unsigned int id, unsigned int prop);

Signed-off-by: Chanwoo Choi 
Tested-by: Chris Zhong 
---
 drivers/extcon/extcon.c | 141 
 include/linux/extcon.h  |  22 
 2 files changed, 163 insertions(+)

diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
index 4027aee08ce5..10b201b161ac 100644
--- a/drivers/extcon/extcon.c
+++ b/drivers/extcon/extcon.c
@@ -201,6 +201,11 @@ struct extcon_cable {
union extcon_property_value chg_propval[EXTCON_PROP_CHG_CNT];
union extcon_property_value jack_propval[EXTCON_PROP_JACK_CNT];
union extcon_property_value disp_propval[EXTCON_PROP_DISP_CNT];
+
+   unsigned long usb_bits[BITS_TO_LONGS(EXTCON_PROP_USB_CNT)];
+   unsigned long chg_bits[BITS_TO_LONGS(EXTCON_PROP_CHG_CNT)];
+   unsigned long jack_bits[BITS_TO_LONGS(EXTCON_PROP_JACK_CNT)];
+   unsigned long disp_bits[BITS_TO_LONGS(EXTCON_PROP_DISP_CNT)];
 };
 
 static struct class *extcon_class;
@@ -297,6 +302,39 @@ static bool is_extcon_property_supported(unsigned int id, 
unsigned int prop)
return !!(extcon_info[id].type & type);
 }
 
+static int is_extcon_property_capability(struct extcon_dev *edev,
+   unsigned int id, int index,unsigned int prop)
+{
+   struct extcon_cable *cable;
+   int type, ret;
+
+   /* Check whether the property is supported or not. */
+   type = get_extcon_type(prop);
+   if (type < 0)
+   return type;
+
+   cable = >cables[index];
+
+   switch (type) {
+   case EXTCON_TYPE_USB:
+   ret = test_bit(prop - EXTCON_PROP_USB_MIN, cable->usb_bits);
+   break;
+   case EXTCON_TYPE_CHG:
+   ret = test_bit(prop - EXTCON_PROP_CHG_MIN, cable->chg_bits);
+   break;
+   case EXTCON_TYPE_JACK:
+   ret = test_bit(prop - EXTCON_PROP_JACK_MIN, cable->jack_bits);
+   break;
+   case EXTCON_TYPE_DISP:
+   ret = test_bit(prop - EXTCON_PROP_DISP_MIN, cable->disp_bits);
+   break;
+   default:
+   ret = -EINVAL;
+   }
+
+   return ret;
+}
+
 static void init_property(struct extcon_dev *edev, unsigned int id, int index)
 {
unsigned int type = extcon_info[id].type;
@@ -554,6 +592,12 @@ int extcon_get_property(struct extcon_dev *edev, unsigned 
int id,
 
spin_lock_irqsave(>lock, flags);
 
+   /* Check whether the property is available or not. */
+   if (!is_extcon_property_capability(edev, id, index, prop)) {
+   spin_unlock_irqrestore(>lock, flags);
+   return -EPERM;
+   }
+
/*
 * Check whether the external connector is attached.
 * If external connector is detached, the user can not
@@ -626,6 +670,12 @@ int extcon_set_property(struct extcon_dev *edev, unsigned 
int id,
 
spin_lock_irqsave(>lock, flags);
 
+   /* Check whether the property is available or not. */
+   if (!is_extcon_property_capability(edev, id, index, prop)) {
+   spin_unlock_irqrestore(>lock, flags);
+   return -EPERM;
+   }
+
cable = >cables[index];
 
/* Set the property value according to extcon type */
@@ -654,6 +704,97 @@ int extcon_set_property(struct extcon_dev *edev, unsigned 
int id,
 EXPORT_SYMBOL_GPL(extcon_set_property);
 
 /**
+ * extcon_get_property_capability() - Get the capability of property
+ * of an external connector.
+ * @edev:  the extcon device that has the cable.
+ * @id:the unique id of each external connector
+ * in extcon enumeration.
+ * @prop:  the property id among enum extcon_property.
+ *
+ * Returns 1 if the property is available or 0 if not available.
+ */
+int extcon_get_property_capability(struct extcon_dev *edev, unsigned int id,
+   unsigned int prop)
+{
+   int index;
+
+   if (!edev)
+   return -EINVAL;
+
+   /* Check whether the property is supported or not */
+   if (!is_extcon_property_supported(id, prop))
+   return -EINVAL;
+
+   /* Find the cable index of external connector by using id */
+   index = find_cable_index_by_id(edev, id);
+   if (index < 0)
+   return index;
+
+   return is_extcon_property_capability(edev, id, index, prop);
+}
+EXPORT_SYMBOL_GPL(extcon_get_property_capability);
+
+/**
+ 

[PATCH v2 5/6] extcon: Add the synchronization extcon APIs to support the notification

2016-07-31 Thread Chanwoo Choi
This patch adds the synchronization extcon APIs to support the notifications
for both state and property. When extcon_*_sync() functions is called,
the extcon informs the information from extcon provider to extcon client.

The extcon driver may need to change the both state and multiple properties
at the same time. After setting the data of a external connector,
the extcon send the notification to client driver with the extcon_*_sync().

The list of new extcon APIs as following:
- extcon_sync() : Send the notification for each external connector to
synchronize the information between extcon provider driver
and extcon client driver.
- extcon_set_state_sync() : Set the state of external connector with noti.
- extcon_set_property_sync() : Set the property of external connector with noti.

For example,
case 1, change the state of external connector and synchronized the data.
extcon_set_state_sync(edev, EXTCON_USB, 1);

case 2, change both the state and property of external connector
and synchronized the data.
extcon_set_state(edev, EXTCON_USB, 1);
extcon_set_property(edev, EXTCON_USB, EXTCON_PROP_USB_ID, 1);
extcon_sync(edev, EXTCON_USB);

case 3, change the property of external connector and synchronized the data.
extcon_set_property(edev, EXTCON_USB, EXTCON_PROP_USB_VBUS, 0);
extcon_set_property(edev, EXTCON_USB, EXTCON_PROP_USB_ID, 1);
extcon_sync(edev, EXTCON_USB);

case 4, change the property of external connector and synchronized the data.
extcon_set_property_sync(edev, EXTCON_USB, EXTCON_PROP_USB_VBUS, 0);

Signed-off-by: Chanwoo Choi 
Tested-by: Chris Zhong 
---
 drivers/extcon/extcon.c | 210 +++-
 include/linux/extcon.h  |  30 ++-
 2 files changed, 164 insertions(+), 76 deletions(-)

diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
index 207143347fb7..680246cceb62 100644
--- a/drivers/extcon/extcon.c
+++ b/drivers/extcon/extcon.c
@@ -279,14 +279,11 @@ static bool is_extcon_attached(struct extcon_dev *edev, 
unsigned int index)
return !!(edev->state & BIT(index));
 }
 
-static bool is_extcon_changed(u32 prev, u32 new, int idx, bool *attached)
+static bool is_extcon_changed(struct extcon_dev *edev, int index,
+   bool new_state)
 {
-   if (((prev >> idx) & 0x1) != ((new >> idx) & 0x1)) {
-   *attached = ((new >> idx) & 0x1) ? true : false;
-   return true;
-   }
-
-   return false;
+   int state = !!(edev->state & (1 << index));
+   return (state != new_state) ? true : false;
 }
 
 static bool is_extcon_property_supported(unsigned int id, unsigned int prop)
@@ -402,21 +399,13 @@ static ssize_t cable_state_show(struct device *dev,
 }
 
 /**
- * extcon_update_state() - Update the cable attach states of the extcon device
- *only for the masked bits.
- * @edev:  the extcon device
- * @mask:  the bit mask to designate updated bits.
- * @state: new cable attach status for @edev
- *
- * Changing the state sends uevent with environment variable containing
- * the name of extcon device (envp[0]) and the state output (envp[1]).
- * Tizen uses this format for extcon device to get events from ports.
- * Android uses this format as well.
+ * extcon_sync()   - Synchronize the states for both the attached/detached
+ * @edev:  the extcon device that has the cable.
  *
- * Note that the notifier provides which bits are changed in the state
- * variable with the val parameter (second) to the callback.
+ * This function send a notification to synchronize the all states of a
+ * specific external connector
  */
-static int extcon_update_state(struct extcon_dev *edev, u32 mask, u32 state)
+int extcon_sync(struct extcon_dev *edev, unsigned int id)
 {
char name_buf[120];
char state_buf[120];
@@ -425,73 +414,58 @@ static int extcon_update_state(struct extcon_dev *edev, 
u32 mask, u32 state)
int env_offset = 0;
int length;
int index;
+   int state;
unsigned long flags;
-   bool attached;
 
if (!edev)
return -EINVAL;
 
+   index = find_cable_index_by_id(edev, id);
+   if (index < 0)
+   return index;
+
spin_lock_irqsave(>lock, flags);
 
-   if (edev->state != ((edev->state & ~mask) | (state & mask))) {
-   u32 old_state;
+   state = !!(edev->state & (1 << index));
+   raw_notifier_call_chain(>nh[index], state, edev);
 
-   if (check_mutually_exclusive(edev, (edev->state & ~mask) |
-  (state & mask))) {
-   spin_unlock_irqrestore(>lock, flags);
-   return -EPERM;
-   }
+   /* This could be in interrupt handler */
+   prop_buf = (char *)get_zeroed_page(GFP_ATOMIC);
+   if (!prop_buf) {

[PATCH v2 4/6] extcon: Rename the extcon_set/get_state() to maintain the function naming pattern

2016-07-31 Thread Chanwoo Choi
This patch just renames the existing extcon_get/set_cable_state_()
as following because of maintaining the function naming pattern
like as extcon APIs for property.
- extcon_set_cable_state_() -> extcon_set_state()
- extcon_get_cable_state_() -> extcon_get_state()

But, this patch remains the old extcon_set/get_cable_state_() functions
to prevent the build break. After altering new APIs, remove the old APIs.

Signed-off-by: Chanwoo Choi 
Tested-by: Chris Zhong 
---
 drivers/extcon/extcon.c | 28 +---
 include/linux/extcon.h  | 25 ++---
 2 files changed, 31 insertions(+), 22 deletions(-)

diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
index 10b201b161ac..207143347fb7 100644
--- a/drivers/extcon/extcon.c
+++ b/drivers/extcon/extcon.c
@@ -398,8 +398,7 @@ static ssize_t cable_state_show(struct device *dev,
int i = cable->cable_index;
 
return sprintf(buf, "%d\n",
-  extcon_get_cable_state_(cable->edev,
-  
cable->edev->supported_cable[i]));
+   extcon_get_state(cable->edev, cable->edev->supported_cable[i]));
 }
 
 /**
@@ -495,13 +494,14 @@ static int extcon_update_state(struct extcon_dev *edev, 
u32 mask, u32 state)
 }
 
 /**
- * extcon_get_cable_state_() - Get the status of a specific cable.
+ * extcon_get_state() - Get the state of a external connector.
  * @edev:  the extcon device that has the cable.
  * @id:the unique id of each external connector in extcon 
enumeration.
  */
-int extcon_get_cable_state_(struct extcon_dev *edev, const unsigned int id)
+int extcon_get_state(struct extcon_dev *edev, const unsigned int id)
 {
-   int index;
+   int index, state;
+   unsigned long flags;
 
if (!edev)
return -EINVAL;
@@ -510,22 +510,23 @@ int extcon_get_cable_state_(struct extcon_dev *edev, 
const unsigned int id)
if (index < 0)
return index;
 
-   if (edev->max_supported && edev->max_supported <= index)
-   return -EINVAL;
+   spin_lock_irqsave(>lock, flags);
+   state = is_extcon_attached(edev, index);
+   spin_unlock_irqrestore(>lock, flags);
 
-   return (int)(is_extcon_attached(edev, index));
+   return state;
 }
-EXPORT_SYMBOL_GPL(extcon_get_cable_state_);
+EXPORT_SYMBOL_GPL(extcon_get_state);
 
 /**
- * extcon_set_cable_state_() - Set the status of a specific cable.
+ * extcon_set_state() - Set the state of a external connector.
  * @edev:  the extcon device that has the cable.
  * @id:the unique id of each external connector
  * in extcon enumeration.
  * @state: the new cable status. The default semantics is
  * true: attached / false: detached.
  */
-int extcon_set_cable_state_(struct extcon_dev *edev, unsigned int id,
+int extcon_set_state(struct extcon_dev *edev, unsigned int id,
bool cable_state)
 {
u32 state;
@@ -538,9 +539,6 @@ int extcon_set_cable_state_(struct extcon_dev *edev, 
unsigned int id,
if (index < 0)
return index;
 
-   if (edev->max_supported && edev->max_supported <= index)
-   return -EINVAL;
-
/*
 * Initialize the value of extcon property before setting
 * the detached state for an external connector.
@@ -551,7 +549,7 @@ int extcon_set_cable_state_(struct extcon_dev *edev, 
unsigned int id,
state = cable_state ? (1 << index) : 0;
return extcon_update_state(edev, 1 << index, state);
 }
-EXPORT_SYMBOL_GPL(extcon_set_cable_state_);
+EXPORT_SYMBOL_GPL(extcon_set_state);
 
 /**
  * extcon_get_property() - Get the property value of a specific cable.
diff --git a/include/linux/extcon.h b/include/linux/extcon.h
index 80b740d81b1f..a38a42418195 100644
--- a/include/linux/extcon.h
+++ b/include/linux/extcon.h
@@ -221,11 +221,11 @@ extern struct extcon_dev *devm_extcon_dev_allocate(struct 
device *dev,
 extern void devm_extcon_dev_free(struct device *dev, struct extcon_dev *edev);
 
 /*
- * get/set_cable_state access each bit of the 32b encoded state value.
+ * get/set_state access each bit of the 32b encoded state value.
  * They are used to access the status of each cable based on the cable id.
  */
-extern int extcon_get_cable_state_(struct extcon_dev *edev, unsigned int id);
-extern int extcon_set_cable_state_(struct extcon_dev *edev, unsigned int id,
+extern int extcon_get_state(struct extcon_dev *edev, unsigned int id);
+extern int extcon_set_state(struct extcon_dev *edev, unsigned int id,
   bool cable_state);
 
 /*
@@ -310,14 +310,14 @@ static inline struct extcon_dev 
*devm_extcon_dev_allocate(struct device *dev,
 
 static inline void devm_extcon_dev_free(struct extcon_dev *edev) { }
 
-static inline int extcon_get_cable_state_(struct 

[PATCH v2 1/6] extcon: Add the extcon_type to gather each connector into five category

2016-07-31 Thread Chanwoo Choi
This patch adds the new extcon type to group the each connecotr
into following five category. This type would be used to handle
the connectors as a group unit instead of a connector unit.
- EXTCON_TYPE_USB  : USB connector
- EXTCON_TYPE_CHG  : Charger connector
- EXTCON_TYPE_JACK : Jack connector
- EXTCON_TYPE_DISP : Display connector
- EXTCON_TYPE_MISC : Miscellaneous connector

Also, each external connector is possible to belong to one more extcon type.
In caes of EXTCON_CHG_USB_SDP, it have the EXTCON_TYPE_CHG and EXTCON_TYPE_USB.

Signed-off-by: Chanwoo Choi 
Tested-by: Chris Zhong 
Signed-off-by: MyungJoo Ham 
---
 drivers/extcon/extcon.c | 159 +++-
 include/linux/extcon.h  |   9 +++
 2 files changed, 139 insertions(+), 29 deletions(-)

diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
index 5b61000cde26..b1e6ee6194bc 100644
--- a/drivers/extcon/extcon.c
+++ b/drivers/extcon/extcon.c
@@ -38,43 +38,144 @@
 #define SUPPORTED_CABLE_MAX32
 #define CABLE_NAME_MAX 30
 
-static const char *extcon_name[] =  {
-   [EXTCON_NONE]   = "NONE",
+struct __extcon_info {
+   unsigned int type;
+   unsigned int id;
+   const char *name;
+
+} extcon_info[] = {
+   [EXTCON_NONE] = {
+   .type = EXTCON_TYPE_MISC,
+   .id = EXTCON_NONE,
+   .name = "NONE",
+   },
 
/* USB external connector */
-   [EXTCON_USB]= "USB",
-   [EXTCON_USB_HOST]   = "USB-HOST",
+   [EXTCON_USB] = {
+   .type = EXTCON_TYPE_USB,
+   .id = EXTCON_USB,
+   .name = "USB",
+   },
+   [EXTCON_USB_HOST] = {
+   .type = EXTCON_TYPE_USB,
+   .id = EXTCON_USB,
+   .name = "USB_HOST",
+   },
 
/* Charging external connector */
-   [EXTCON_CHG_USB_SDP]= "SDP",
-   [EXTCON_CHG_USB_DCP]= "DCP",
-   [EXTCON_CHG_USB_CDP]= "CDP",
-   [EXTCON_CHG_USB_ACA]= "ACA",
-   [EXTCON_CHG_USB_FAST]   = "FAST-CHARGER",
-   [EXTCON_CHG_USB_SLOW]   = "SLOW-CHARGER",
+   [EXTCON_CHG_USB_SDP] = {
+   .type = EXTCON_TYPE_CHG | EXTCON_TYPE_USB,
+   .id = EXTCON_CHG_USB_SDP,
+   .name = "SDP",
+   },
+   [EXTCON_CHG_USB_DCP] = {
+   .type = EXTCON_TYPE_CHG | EXTCON_TYPE_USB,
+   .id = EXTCON_CHG_USB_DCP,
+   .name = "DCP",
+   },
+   [EXTCON_CHG_USB_CDP] = {
+   .type = EXTCON_TYPE_CHG | EXTCON_TYPE_USB,
+   .id = EXTCON_CHG_USB_CDP,
+   .name = "CDP",
+   },
+   [EXTCON_CHG_USB_ACA] = {
+   .type = EXTCON_TYPE_CHG | EXTCON_TYPE_USB,
+   .id = EXTCON_CHG_USB_ACA,
+   .name = "ACA",
+   },
+   [EXTCON_CHG_USB_FAST] = {
+   .type = EXTCON_TYPE_CHG | EXTCON_TYPE_USB,
+   .id = EXTCON_CHG_USB_FAST,
+   .name = "FAST-CHARGER",
+   },
+   [EXTCON_CHG_USB_SLOW] = {
+   .type = EXTCON_TYPE_CHG | EXTCON_TYPE_USB,
+   .id = EXTCON_CHG_USB_SLOW,
+   .name = "SLOW-CHARGER",
+   },
 
/* Jack external connector */
-   [EXTCON_JACK_MICROPHONE]= "MICROPHONE",
-   [EXTCON_JACK_HEADPHONE] = "HEADPHONE",
-   [EXTCON_JACK_LINE_IN]   = "LINE-IN",
-   [EXTCON_JACK_LINE_OUT]  = "LINE-OUT",
-   [EXTCON_JACK_VIDEO_IN]  = "VIDEO-IN",
-   [EXTCON_JACK_VIDEO_OUT] = "VIDEO-OUT",
-   [EXTCON_JACK_SPDIF_IN]  = "SPDIF-IN",
-   [EXTCON_JACK_SPDIF_OUT] = "SPDIF-OUT",
+   [EXTCON_JACK_MICROPHONE] = {
+   .type = EXTCON_TYPE_JACK,
+   .id = EXTCON_JACK_MICROPHONE,
+   .name = "MICROPHONE",
+   },
+   [EXTCON_JACK_HEADPHONE] = {
+   .type = EXTCON_TYPE_JACK,
+   .id = EXTCON_JACK_HEADPHONE,
+   .name = "HEADPHONE",
+   },
+   [EXTCON_JACK_LINE_IN] = {
+   .type = EXTCON_TYPE_JACK,
+   .id = EXTCON_JACK_LINE_IN,
+   .name = "LINE-IN",
+   },
+   [EXTCON_JACK_LINE_OUT] = {
+   .type = EXTCON_TYPE_JACK,
+   .id = EXTCON_JACK_LINE_OUT,
+   .name = "LINE-OUT",
+   },
+   [EXTCON_JACK_VIDEO_IN] = {
+   .type = EXTCON_TYPE_JACK,
+   .id = EXTCON_JACK_VIDEO_IN,
+   .name = "VIDEO-IN",
+   },
+   [EXTCON_JACK_VIDEO_OUT] = {
+   .type = EXTCON_TYPE_JACK,
+   .id = EXTCON_JACK_VIDEO_OUT,
+   .name = "VIDEO-OUT",
+   },
+   [EXTCON_JACK_SPDIF_IN] = {
+   .type = EXTCON_TYPE_JACK,
+   .id = EXTCON_JACK_SPDIF_IN,
+   .name = 

[PATCH v2 6/6] extcon: Add EXTCON_DISP_DP and the property for USB Type-C

2016-07-31 Thread Chanwoo Choi
From: Chris Zhong 

Add EXTCON_DISP_DP for the Display external connector. For Type-C
connector the DisplayPort can work as an Alternate Mode(VESA DisplayPort
Alt Mode on USB Type-C Standard). The Type-C support both normal
and flipped orientation, so add a property to extcon.

Signed-off-by: Chris Zhong 
Signed-off-by: Chanwoo Choi 
Reviewed-by: Guenter Roeck 
---
 drivers/extcon/extcon.c | 5 +
 include/linux/extcon.h  | 8 +++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
index 680246cceb62..6ad966adec43 100644
--- a/drivers/extcon/extcon.c
+++ b/drivers/extcon/extcon.c
@@ -157,6 +157,11 @@ struct __extcon_info {
.id = EXTCON_DISP_VGA,
.name = "VGA",
},
+   [EXTCON_DISP_DP] = {
+   .type = EXTCON_TYPE_DISP | EXTCON_TYPE_USB,
+   .id = EXTCON_DISP_DP,
+   .name = "DP",
+   },
 
/* Miscellaneous external connector */
[EXTCON_DOCK] = {
diff --git a/include/linux/extcon.h b/include/linux/extcon.h
index f686204fb4c7..9670d3f6bc32 100644
--- a/include/linux/extcon.h
+++ b/include/linux/extcon.h
@@ -69,6 +69,7 @@
 #define EXTCON_DISP_MHL41  /* Mobile High-Definition Link 
*/
 #define EXTCON_DISP_DVI42  /* Digital Visual Interface */
 #define EXTCON_DISP_VGA43  /* Video Graphics Array */
+#define EXTCON_DISP_DP 44  /* Display Port */
 
 /* Miscellaneous external connector */
 #define EXTCON_DOCK60
@@ -106,12 +107,17 @@
  * @type:  integer (intval)
  * @value: 0 (low) or 1 (high)
  * @default:   0 (low)
+ * - EXTCON_PROP_USB_TYPEC_POLARITY
+ * @type:  integer (intval)
+ * @value: 0 (normal) or 1 (flip)
+ * @default:   0 (normal)
  */
 #define EXTCON_PROP_USB_ID 0
 #define EXTCON_PROP_USB_VBUS   1
+#define EXTCON_PROP_USB_TYPEC_POLARITY 2
 
 #define EXTCON_PROP_USB_MIN0
-#define EXTCON_PROP_USB_MAX1
+#define EXTCON_PROP_USB_MAX2
 #define EXTCON_PROP_USB_CNT(EXTCON_PROP_USB_MAX - EXTCON_PROP_USB_MIN + 1)
 
 /* Properties of EXTCON_TYPE_CHG. */
-- 
1.9.1



[PATCH v2 4/6] extcon: Rename the extcon_set/get_state() to maintain the function naming pattern

2016-07-31 Thread Chanwoo Choi
This patch just renames the existing extcon_get/set_cable_state_()
as following because of maintaining the function naming pattern
like as extcon APIs for property.
- extcon_set_cable_state_() -> extcon_set_state()
- extcon_get_cable_state_() -> extcon_get_state()

But, this patch remains the old extcon_set/get_cable_state_() functions
to prevent the build break. After altering new APIs, remove the old APIs.

Signed-off-by: Chanwoo Choi 
Tested-by: Chris Zhong 
---
 drivers/extcon/extcon.c | 28 +---
 include/linux/extcon.h  | 25 ++---
 2 files changed, 31 insertions(+), 22 deletions(-)

diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
index 10b201b161ac..207143347fb7 100644
--- a/drivers/extcon/extcon.c
+++ b/drivers/extcon/extcon.c
@@ -398,8 +398,7 @@ static ssize_t cable_state_show(struct device *dev,
int i = cable->cable_index;
 
return sprintf(buf, "%d\n",
-  extcon_get_cable_state_(cable->edev,
-  
cable->edev->supported_cable[i]));
+   extcon_get_state(cable->edev, cable->edev->supported_cable[i]));
 }
 
 /**
@@ -495,13 +494,14 @@ static int extcon_update_state(struct extcon_dev *edev, 
u32 mask, u32 state)
 }
 
 /**
- * extcon_get_cable_state_() - Get the status of a specific cable.
+ * extcon_get_state() - Get the state of a external connector.
  * @edev:  the extcon device that has the cable.
  * @id:the unique id of each external connector in extcon 
enumeration.
  */
-int extcon_get_cable_state_(struct extcon_dev *edev, const unsigned int id)
+int extcon_get_state(struct extcon_dev *edev, const unsigned int id)
 {
-   int index;
+   int index, state;
+   unsigned long flags;
 
if (!edev)
return -EINVAL;
@@ -510,22 +510,23 @@ int extcon_get_cable_state_(struct extcon_dev *edev, 
const unsigned int id)
if (index < 0)
return index;
 
-   if (edev->max_supported && edev->max_supported <= index)
-   return -EINVAL;
+   spin_lock_irqsave(>lock, flags);
+   state = is_extcon_attached(edev, index);
+   spin_unlock_irqrestore(>lock, flags);
 
-   return (int)(is_extcon_attached(edev, index));
+   return state;
 }
-EXPORT_SYMBOL_GPL(extcon_get_cable_state_);
+EXPORT_SYMBOL_GPL(extcon_get_state);
 
 /**
- * extcon_set_cable_state_() - Set the status of a specific cable.
+ * extcon_set_state() - Set the state of a external connector.
  * @edev:  the extcon device that has the cable.
  * @id:the unique id of each external connector
  * in extcon enumeration.
  * @state: the new cable status. The default semantics is
  * true: attached / false: detached.
  */
-int extcon_set_cable_state_(struct extcon_dev *edev, unsigned int id,
+int extcon_set_state(struct extcon_dev *edev, unsigned int id,
bool cable_state)
 {
u32 state;
@@ -538,9 +539,6 @@ int extcon_set_cable_state_(struct extcon_dev *edev, 
unsigned int id,
if (index < 0)
return index;
 
-   if (edev->max_supported && edev->max_supported <= index)
-   return -EINVAL;
-
/*
 * Initialize the value of extcon property before setting
 * the detached state for an external connector.
@@ -551,7 +549,7 @@ int extcon_set_cable_state_(struct extcon_dev *edev, 
unsigned int id,
state = cable_state ? (1 << index) : 0;
return extcon_update_state(edev, 1 << index, state);
 }
-EXPORT_SYMBOL_GPL(extcon_set_cable_state_);
+EXPORT_SYMBOL_GPL(extcon_set_state);
 
 /**
  * extcon_get_property() - Get the property value of a specific cable.
diff --git a/include/linux/extcon.h b/include/linux/extcon.h
index 80b740d81b1f..a38a42418195 100644
--- a/include/linux/extcon.h
+++ b/include/linux/extcon.h
@@ -221,11 +221,11 @@ extern struct extcon_dev *devm_extcon_dev_allocate(struct 
device *dev,
 extern void devm_extcon_dev_free(struct device *dev, struct extcon_dev *edev);
 
 /*
- * get/set_cable_state access each bit of the 32b encoded state value.
+ * get/set_state access each bit of the 32b encoded state value.
  * They are used to access the status of each cable based on the cable id.
  */
-extern int extcon_get_cable_state_(struct extcon_dev *edev, unsigned int id);
-extern int extcon_set_cable_state_(struct extcon_dev *edev, unsigned int id,
+extern int extcon_get_state(struct extcon_dev *edev, unsigned int id);
+extern int extcon_set_state(struct extcon_dev *edev, unsigned int id,
   bool cable_state);
 
 /*
@@ -310,14 +310,14 @@ static inline struct extcon_dev 
*devm_extcon_dev_allocate(struct device *dev,
 
 static inline void devm_extcon_dev_free(struct extcon_dev *edev) { }
 
-static inline int extcon_get_cable_state_(struct extcon_dev *edev,
-   

[PATCH v2 1/6] extcon: Add the extcon_type to gather each connector into five category

2016-07-31 Thread Chanwoo Choi
This patch adds the new extcon type to group the each connecotr
into following five category. This type would be used to handle
the connectors as a group unit instead of a connector unit.
- EXTCON_TYPE_USB  : USB connector
- EXTCON_TYPE_CHG  : Charger connector
- EXTCON_TYPE_JACK : Jack connector
- EXTCON_TYPE_DISP : Display connector
- EXTCON_TYPE_MISC : Miscellaneous connector

Also, each external connector is possible to belong to one more extcon type.
In caes of EXTCON_CHG_USB_SDP, it have the EXTCON_TYPE_CHG and EXTCON_TYPE_USB.

Signed-off-by: Chanwoo Choi 
Tested-by: Chris Zhong 
Signed-off-by: MyungJoo Ham 
---
 drivers/extcon/extcon.c | 159 +++-
 include/linux/extcon.h  |   9 +++
 2 files changed, 139 insertions(+), 29 deletions(-)

diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
index 5b61000cde26..b1e6ee6194bc 100644
--- a/drivers/extcon/extcon.c
+++ b/drivers/extcon/extcon.c
@@ -38,43 +38,144 @@
 #define SUPPORTED_CABLE_MAX32
 #define CABLE_NAME_MAX 30
 
-static const char *extcon_name[] =  {
-   [EXTCON_NONE]   = "NONE",
+struct __extcon_info {
+   unsigned int type;
+   unsigned int id;
+   const char *name;
+
+} extcon_info[] = {
+   [EXTCON_NONE] = {
+   .type = EXTCON_TYPE_MISC,
+   .id = EXTCON_NONE,
+   .name = "NONE",
+   },
 
/* USB external connector */
-   [EXTCON_USB]= "USB",
-   [EXTCON_USB_HOST]   = "USB-HOST",
+   [EXTCON_USB] = {
+   .type = EXTCON_TYPE_USB,
+   .id = EXTCON_USB,
+   .name = "USB",
+   },
+   [EXTCON_USB_HOST] = {
+   .type = EXTCON_TYPE_USB,
+   .id = EXTCON_USB,
+   .name = "USB_HOST",
+   },
 
/* Charging external connector */
-   [EXTCON_CHG_USB_SDP]= "SDP",
-   [EXTCON_CHG_USB_DCP]= "DCP",
-   [EXTCON_CHG_USB_CDP]= "CDP",
-   [EXTCON_CHG_USB_ACA]= "ACA",
-   [EXTCON_CHG_USB_FAST]   = "FAST-CHARGER",
-   [EXTCON_CHG_USB_SLOW]   = "SLOW-CHARGER",
+   [EXTCON_CHG_USB_SDP] = {
+   .type = EXTCON_TYPE_CHG | EXTCON_TYPE_USB,
+   .id = EXTCON_CHG_USB_SDP,
+   .name = "SDP",
+   },
+   [EXTCON_CHG_USB_DCP] = {
+   .type = EXTCON_TYPE_CHG | EXTCON_TYPE_USB,
+   .id = EXTCON_CHG_USB_DCP,
+   .name = "DCP",
+   },
+   [EXTCON_CHG_USB_CDP] = {
+   .type = EXTCON_TYPE_CHG | EXTCON_TYPE_USB,
+   .id = EXTCON_CHG_USB_CDP,
+   .name = "CDP",
+   },
+   [EXTCON_CHG_USB_ACA] = {
+   .type = EXTCON_TYPE_CHG | EXTCON_TYPE_USB,
+   .id = EXTCON_CHG_USB_ACA,
+   .name = "ACA",
+   },
+   [EXTCON_CHG_USB_FAST] = {
+   .type = EXTCON_TYPE_CHG | EXTCON_TYPE_USB,
+   .id = EXTCON_CHG_USB_FAST,
+   .name = "FAST-CHARGER",
+   },
+   [EXTCON_CHG_USB_SLOW] = {
+   .type = EXTCON_TYPE_CHG | EXTCON_TYPE_USB,
+   .id = EXTCON_CHG_USB_SLOW,
+   .name = "SLOW-CHARGER",
+   },
 
/* Jack external connector */
-   [EXTCON_JACK_MICROPHONE]= "MICROPHONE",
-   [EXTCON_JACK_HEADPHONE] = "HEADPHONE",
-   [EXTCON_JACK_LINE_IN]   = "LINE-IN",
-   [EXTCON_JACK_LINE_OUT]  = "LINE-OUT",
-   [EXTCON_JACK_VIDEO_IN]  = "VIDEO-IN",
-   [EXTCON_JACK_VIDEO_OUT] = "VIDEO-OUT",
-   [EXTCON_JACK_SPDIF_IN]  = "SPDIF-IN",
-   [EXTCON_JACK_SPDIF_OUT] = "SPDIF-OUT",
+   [EXTCON_JACK_MICROPHONE] = {
+   .type = EXTCON_TYPE_JACK,
+   .id = EXTCON_JACK_MICROPHONE,
+   .name = "MICROPHONE",
+   },
+   [EXTCON_JACK_HEADPHONE] = {
+   .type = EXTCON_TYPE_JACK,
+   .id = EXTCON_JACK_HEADPHONE,
+   .name = "HEADPHONE",
+   },
+   [EXTCON_JACK_LINE_IN] = {
+   .type = EXTCON_TYPE_JACK,
+   .id = EXTCON_JACK_LINE_IN,
+   .name = "LINE-IN",
+   },
+   [EXTCON_JACK_LINE_OUT] = {
+   .type = EXTCON_TYPE_JACK,
+   .id = EXTCON_JACK_LINE_OUT,
+   .name = "LINE-OUT",
+   },
+   [EXTCON_JACK_VIDEO_IN] = {
+   .type = EXTCON_TYPE_JACK,
+   .id = EXTCON_JACK_VIDEO_IN,
+   .name = "VIDEO-IN",
+   },
+   [EXTCON_JACK_VIDEO_OUT] = {
+   .type = EXTCON_TYPE_JACK,
+   .id = EXTCON_JACK_VIDEO_OUT,
+   .name = "VIDEO-OUT",
+   },
+   [EXTCON_JACK_SPDIF_IN] = {
+   .type = EXTCON_TYPE_JACK,
+   .id = EXTCON_JACK_SPDIF_IN,
+   .name = "SPDIF-IN",
+   },
+   [EXTCON_JACK_SPDIF_OUT] = {
+   

[PATCH v2 6/6] extcon: Add EXTCON_DISP_DP and the property for USB Type-C

2016-07-31 Thread Chanwoo Choi
From: Chris Zhong 

Add EXTCON_DISP_DP for the Display external connector. For Type-C
connector the DisplayPort can work as an Alternate Mode(VESA DisplayPort
Alt Mode on USB Type-C Standard). The Type-C support both normal
and flipped orientation, so add a property to extcon.

Signed-off-by: Chris Zhong 
Signed-off-by: Chanwoo Choi 
Reviewed-by: Guenter Roeck 
---
 drivers/extcon/extcon.c | 5 +
 include/linux/extcon.h  | 8 +++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
index 680246cceb62..6ad966adec43 100644
--- a/drivers/extcon/extcon.c
+++ b/drivers/extcon/extcon.c
@@ -157,6 +157,11 @@ struct __extcon_info {
.id = EXTCON_DISP_VGA,
.name = "VGA",
},
+   [EXTCON_DISP_DP] = {
+   .type = EXTCON_TYPE_DISP | EXTCON_TYPE_USB,
+   .id = EXTCON_DISP_DP,
+   .name = "DP",
+   },
 
/* Miscellaneous external connector */
[EXTCON_DOCK] = {
diff --git a/include/linux/extcon.h b/include/linux/extcon.h
index f686204fb4c7..9670d3f6bc32 100644
--- a/include/linux/extcon.h
+++ b/include/linux/extcon.h
@@ -69,6 +69,7 @@
 #define EXTCON_DISP_MHL41  /* Mobile High-Definition Link 
*/
 #define EXTCON_DISP_DVI42  /* Digital Visual Interface */
 #define EXTCON_DISP_VGA43  /* Video Graphics Array */
+#define EXTCON_DISP_DP 44  /* Display Port */
 
 /* Miscellaneous external connector */
 #define EXTCON_DOCK60
@@ -106,12 +107,17 @@
  * @type:  integer (intval)
  * @value: 0 (low) or 1 (high)
  * @default:   0 (low)
+ * - EXTCON_PROP_USB_TYPEC_POLARITY
+ * @type:  integer (intval)
+ * @value: 0 (normal) or 1 (flip)
+ * @default:   0 (normal)
  */
 #define EXTCON_PROP_USB_ID 0
 #define EXTCON_PROP_USB_VBUS   1
+#define EXTCON_PROP_USB_TYPEC_POLARITY 2
 
 #define EXTCON_PROP_USB_MIN0
-#define EXTCON_PROP_USB_MAX1
+#define EXTCON_PROP_USB_MAX2
 #define EXTCON_PROP_USB_CNT(EXTCON_PROP_USB_MAX - EXTCON_PROP_USB_MIN + 1)
 
 /* Properties of EXTCON_TYPE_CHG. */
-- 
1.9.1



[PATCH v2 2/6] extcon: Add the support for extcon property according to extcon type

2016-07-31 Thread Chanwoo Choi
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 
Tested-by: Chris Zhong 
---
 drivers/extcon/extcon.c | 201 +++-
 include/linux/extcon.h  |  86 +
 2 files changed, 286 insertions(+), 1 deletion(-)

diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
index b1e6ee6194bc..4027aee08ce5 100644
--- a/drivers/extcon/extcon.c
+++ b/drivers/extcon/extcon.c
@@ -196,6 +196,11 @@ struct extcon_cable {
struct device_attribute attr_state;
 
struct attribute *attrs[3]; /* to be fed to attr_g.attrs */
+
+   union extcon_property_value usb_propval[EXTCON_PROP_USB_CNT];
+   union extcon_property_value chg_propval[EXTCON_PROP_CHG_CNT];
+   union extcon_property_value jack_propval[EXTCON_PROP_JACK_CNT];
+   union extcon_property_value disp_propval[EXTCON_PROP_DISP_CNT];
 };
 
 static struct class *extcon_class;
@@ -248,6 +253,27 @@ static int find_cable_index_by_id(struct extcon_dev *edev, 
const unsigned int id
return -EINVAL;
 }
 
+static int get_extcon_type(unsigned int prop)
+{
+   switch (prop) {
+   case EXTCON_PROP_USB_MIN ... EXTCON_PROP_USB_MAX:
+   return EXTCON_TYPE_USB;
+   case EXTCON_PROP_CHG_MIN ... EXTCON_PROP_CHG_MAX:
+   return EXTCON_TYPE_CHG;
+   case EXTCON_PROP_JACK_MIN ... EXTCON_PROP_JACK_MAX:
+   return EXTCON_TYPE_JACK;
+   case EXTCON_PROP_DISP_MIN ... EXTCON_PROP_DISP_MAX:
+   return EXTCON_TYPE_DISP;
+   default:
+   return -EINVAL;
+   }
+}
+
+static bool is_extcon_attached(struct extcon_dev *edev, unsigned int index)
+{
+   return !!(edev->state & BIT(index));
+}
+
 static bool is_extcon_changed(u32 prev, u32 new, int idx, bool *attached)
 {
if (((prev >> idx) & 0x1) != ((new >> idx) & 0x1)) {
@@ -258,6 +284,34 @@ static bool is_extcon_changed(u32 prev, u32 new, int idx, 
bool *attached)
return false;
 }
 
+static bool is_extcon_property_supported(unsigned int id, unsigned int prop)
+{
+   int type;
+
+   /* Check whether the property is supported or not. */
+   type = get_extcon_type(prop);
+   if (type < 0)
+   return false;
+
+   /* Check whether a specific extcon id supports the property or not. */
+   return !!(extcon_info[id].type & type);
+}
+
+static void init_property(struct extcon_dev *edev, unsigned int id, int index)
+{
+   unsigned int type = extcon_info[id].type;
+   struct extcon_cable *cable = >cables[index];
+
+   if (EXTCON_TYPE_USB & type)
+   memset(cable->usb_propval, 0, sizeof(cable->usb_propval));
+   if (EXTCON_TYPE_CHG & type)
+   memset(cable->chg_propval, 0, sizeof(cable->chg_propval));
+   if (EXTCON_TYPE_JACK & type)
+   memset(cable->jack_propval, 0, sizeof(cable->jack_propval));
+   if (EXTCON_TYPE_DISP & type)
+   memset(cable->disp_propval, 0, sizeof(cable->disp_propval));
+}
+
 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));
 }
 EXPORT_SYMBOL_GPL(extcon_get_cable_state_);
 
@@ -449,12 +503,157 @@ int extcon_set_cable_state_(struct extcon_dev *edev, 
unsigned int id,
if (edev->max_supported && edev->max_supported <= index)
return -EINVAL;
 
+   /*
+* Initialize the value of extcon property before setting
+* the detached state for an external connector.
+*/
+   if (!cable_state)
+   init_property(edev, id, index);
+
state = cable_state ? (1 << index) : 0;
return extcon_update_state(edev, 1 << index, state);
 }
 EXPORT_SYMBOL_GPL(extcon_set_cable_state_);
 
 /**
+ * extcon_get_property() - Get the property value of a specific cable.
+ * @edev:  the extcon device that has the cable.
+ * @id:the unique id of each 

[PATCH v2 2/6] extcon: Add the support for extcon property according to extcon type

2016-07-31 Thread Chanwoo Choi
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 
Tested-by: Chris Zhong 
---
 drivers/extcon/extcon.c | 201 +++-
 include/linux/extcon.h  |  86 +
 2 files changed, 286 insertions(+), 1 deletion(-)

diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
index b1e6ee6194bc..4027aee08ce5 100644
--- a/drivers/extcon/extcon.c
+++ b/drivers/extcon/extcon.c
@@ -196,6 +196,11 @@ struct extcon_cable {
struct device_attribute attr_state;
 
struct attribute *attrs[3]; /* to be fed to attr_g.attrs */
+
+   union extcon_property_value usb_propval[EXTCON_PROP_USB_CNT];
+   union extcon_property_value chg_propval[EXTCON_PROP_CHG_CNT];
+   union extcon_property_value jack_propval[EXTCON_PROP_JACK_CNT];
+   union extcon_property_value disp_propval[EXTCON_PROP_DISP_CNT];
 };
 
 static struct class *extcon_class;
@@ -248,6 +253,27 @@ static int find_cable_index_by_id(struct extcon_dev *edev, 
const unsigned int id
return -EINVAL;
 }
 
+static int get_extcon_type(unsigned int prop)
+{
+   switch (prop) {
+   case EXTCON_PROP_USB_MIN ... EXTCON_PROP_USB_MAX:
+   return EXTCON_TYPE_USB;
+   case EXTCON_PROP_CHG_MIN ... EXTCON_PROP_CHG_MAX:
+   return EXTCON_TYPE_CHG;
+   case EXTCON_PROP_JACK_MIN ... EXTCON_PROP_JACK_MAX:
+   return EXTCON_TYPE_JACK;
+   case EXTCON_PROP_DISP_MIN ... EXTCON_PROP_DISP_MAX:
+   return EXTCON_TYPE_DISP;
+   default:
+   return -EINVAL;
+   }
+}
+
+static bool is_extcon_attached(struct extcon_dev *edev, unsigned int index)
+{
+   return !!(edev->state & BIT(index));
+}
+
 static bool is_extcon_changed(u32 prev, u32 new, int idx, bool *attached)
 {
if (((prev >> idx) & 0x1) != ((new >> idx) & 0x1)) {
@@ -258,6 +284,34 @@ static bool is_extcon_changed(u32 prev, u32 new, int idx, 
bool *attached)
return false;
 }
 
+static bool is_extcon_property_supported(unsigned int id, unsigned int prop)
+{
+   int type;
+
+   /* Check whether the property is supported or not. */
+   type = get_extcon_type(prop);
+   if (type < 0)
+   return false;
+
+   /* Check whether a specific extcon id supports the property or not. */
+   return !!(extcon_info[id].type & type);
+}
+
+static void init_property(struct extcon_dev *edev, unsigned int id, int index)
+{
+   unsigned int type = extcon_info[id].type;
+   struct extcon_cable *cable = >cables[index];
+
+   if (EXTCON_TYPE_USB & type)
+   memset(cable->usb_propval, 0, sizeof(cable->usb_propval));
+   if (EXTCON_TYPE_CHG & type)
+   memset(cable->chg_propval, 0, sizeof(cable->chg_propval));
+   if (EXTCON_TYPE_JACK & type)
+   memset(cable->jack_propval, 0, sizeof(cable->jack_propval));
+   if (EXTCON_TYPE_DISP & type)
+   memset(cable->disp_propval, 0, sizeof(cable->disp_propval));
+}
+
 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));
 }
 EXPORT_SYMBOL_GPL(extcon_get_cable_state_);
 
@@ -449,12 +503,157 @@ int extcon_set_cable_state_(struct extcon_dev *edev, 
unsigned int id,
if (edev->max_supported && edev->max_supported <= index)
return -EINVAL;
 
+   /*
+* Initialize the value of extcon property before setting
+* the detached state for an external connector.
+*/
+   if (!cable_state)
+   init_property(edev, id, index);
+
state = cable_state ? (1 << index) : 0;
return extcon_update_state(edev, 1 << index, state);
 }
 EXPORT_SYMBOL_GPL(extcon_set_cable_state_);
 
 /**
+ * extcon_get_property() - Get the property value of a specific cable.
+ * @edev:  the extcon device that has the cable.
+ * @id:the unique id of each external connector
+ * in 

[PATCH net v2] 8139too: fix system hang when there is a tx timeout event.

2016-07-31 Thread Chunhao Lin
If tx timeout event occur, kernel will call rtl8139_tx_timeout_task() to reset
hardware. But in this function, driver does not stop tx and rx function before
reset hardware, that will cause system hang.

In this patch, add stop tx and rx function before reset hardware.

Signed-off-by: Chunhao Lin 
---
 drivers/net/ethernet/realtek/8139too.c | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/realtek/8139too.c 
b/drivers/net/ethernet/realtek/8139too.c
index ef668d3..da4c2d8 100644
--- a/drivers/net/ethernet/realtek/8139too.c
+++ b/drivers/net/ethernet/realtek/8139too.c
@@ -1667,6 +1667,10 @@ static void rtl8139_tx_timeout_task (struct work_struct 
*work)
int i;
u8 tmp8;
 
+   napi_disable(>napi);
+   netif_stop_queue(dev);
+   synchronize_sched();
+
netdev_dbg(dev, "Transmit timeout, status %02x %04x %04x media %02x\n",
   RTL_R8(ChipCmd), RTL_R16(IntrStatus),
   RTL_R16(IntrMask), RTL_R8(MediaStatus));
@@ -1696,10 +1700,10 @@ static void rtl8139_tx_timeout_task (struct work_struct 
*work)
spin_unlock_irq(>lock);
 
/* ...and finally, reset everything */
-   if (netif_running(dev)) {
-   rtl8139_hw_start (dev);
-   netif_wake_queue (dev);
-   }
+   napi_enable(>napi);
+   rtl8139_hw_start(dev);
+   netif_wake_queue(dev);
+
spin_unlock_bh(>rx_lock);
 }
 
-- 
1.9.1



[PATCH net v2] 8139too: fix system hang when there is a tx timeout event.

2016-07-31 Thread Chunhao Lin
If tx timeout event occur, kernel will call rtl8139_tx_timeout_task() to reset
hardware. But in this function, driver does not stop tx and rx function before
reset hardware, that will cause system hang.

In this patch, add stop tx and rx function before reset hardware.

Signed-off-by: Chunhao Lin 
---
 drivers/net/ethernet/realtek/8139too.c | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/realtek/8139too.c 
b/drivers/net/ethernet/realtek/8139too.c
index ef668d3..da4c2d8 100644
--- a/drivers/net/ethernet/realtek/8139too.c
+++ b/drivers/net/ethernet/realtek/8139too.c
@@ -1667,6 +1667,10 @@ static void rtl8139_tx_timeout_task (struct work_struct 
*work)
int i;
u8 tmp8;
 
+   napi_disable(>napi);
+   netif_stop_queue(dev);
+   synchronize_sched();
+
netdev_dbg(dev, "Transmit timeout, status %02x %04x %04x media %02x\n",
   RTL_R8(ChipCmd), RTL_R16(IntrStatus),
   RTL_R16(IntrMask), RTL_R8(MediaStatus));
@@ -1696,10 +1700,10 @@ static void rtl8139_tx_timeout_task (struct work_struct 
*work)
spin_unlock_irq(>lock);
 
/* ...and finally, reset everything */
-   if (netif_running(dev)) {
-   rtl8139_hw_start (dev);
-   netif_wake_queue (dev);
-   }
+   napi_enable(>napi);
+   rtl8139_hw_start(dev);
+   netif_wake_queue(dev);
+
spin_unlock_bh(>rx_lock);
 }
 
-- 
1.9.1



Re: [RFC] can we use vmalloc to alloc thread stack if compaction failed

2016-07-31 Thread Joonsoo Kim
On Fri, Jul 29, 2016 at 12:47:38PM -0700, Andy Lutomirski wrote:
> -- Forwarded message --
> From: "Joonsoo Kim" 
> Date: Jul 28, 2016 7:57 PM
> Subject: Re: [RFC] can we use vmalloc to alloc thread stack if compaction 
> failed
> To: "Andy Lutomirski" 
> Cc: "Xishi Qiu" , "Michal Hocko"
> , "Tejun Heo" , "Ingo Molnar"
> , "Peter Zijlstra" , "LKML"
> , "Linux MM" ,
> "Yisheng Xie" 
> 
> > On Thu, Jul 28, 2016 at 08:07:51AM -0700, Andy Lutomirski wrote:
> > > On Thu, Jul 28, 2016 at 3:51 AM, Xishi Qiu  wrote:
> > > > On 2016/7/28 17:43, Michal Hocko wrote:
> > > >
> > > >> On Thu 28-07-16 16:45:06, Xishi Qiu wrote:
> > > >>> On 2016/7/28 15:58, Michal Hocko wrote:
> > > >>>
> > >  On Thu 28-07-16 15:41:53, Xishi Qiu wrote:
> > > > On 2016/7/28 15:20, Michal Hocko wrote:
> > > >
> > > >> On Thu 28-07-16 15:08:26, Xishi Qiu wrote:
> > > >>> Usually THREAD_SIZE_ORDER is 2, it means we need to alloc 16kb 
> > > >>> continuous
> > > >>> physical memory during fork a new process.
> > > >>>
> > > >>> If the system's memory is very small, especially the smart phone, 
> > > >>> maybe there
> > > >>> is only 1G memory. So the free memory is very small and 
> > > >>> compaction is not
> > > >>> always success in slowpath(__alloc_pages_slowpath), then alloc 
> > > >>> thread stack
> > > >>> may be failed for memory fragment.
> > > >>
> > > >> Well, with the current implementation of the page allocator those
> > > >> requests will not fail in most cases. The oom killer would be 
> > > >> invoked in
> > > >> order to free up some memory.
> > > >>
> > > >
> > > > Hi Michal,
> > > >
> > > > Yes, it success in most cases, but I did have seen this problem in 
> > > > some
> > > > stress-test.
> > > >
> > > > DMA free:470628kB, but alloc 2 order block failed during fork a new 
> > > > process.
> > > > There are so many memory fragments and the large block may be soon 
> > > > taken by
> > > > others after compact because of stress-test.
> > > >
> > > > --- dmesg messages ---
> > > > 07-13 08:41:51.341 
> > > > <4>[309805.658142s][pid:1361,cpu5,sManagerService]sManagerService: 
> > > > page allocation failure: order:2, mode:0x2000d1
> > > 
> > >  Yes but this is __GFP_DMA allocation. I guess you have already 
> > >  reported
> > >  this failure and you've been told that this is quite unexpected for 
> > >  the
> > >  kernel stack allocation. It is your out-of-tree patch which just 
> > >  makes
> > >  things worse because DMA restricted allocations are considered 
> > >  "lowmem"
> > >  and so they do not invoke OOM killer and do not retry like regular
> > >  GFP_KERNEL allocations.
> > > >>>
> > > >>> Hi Michal,
> > > >>>
> > > >>> Yes, we add GFP_DMA, but I don't think this is the key for the 
> > > >>> problem.
> > > >>
> > > >> You are restricting the allocation request to a single zone which is
> > > >> definitely not good. Look at how many larger order pages are available
> > > >> in the Normal zone.
> > > >>
> > > >>> If we do oom-killer, maybe we will get a large block later, but there
> > > >>> is enough free memory before oom(although most of them are fragments).
> > > >>
> > > >> Killing a task is of course the last resort action. It would give you
> > > >> larger order blocks used for the victims thread.
> > > >>
> > > >>> I wonder if we can alloc success without kill any process in this 
> > > >>> situation.
> > > >>
> > > >> Sure it would be preferable to compact that memory but that might be
> > > >> hard with your restriction in place. Consider that DMA zone would tend
> > > >> to be less movable than normal zones as users would have to pin it for
> > > >> DMA. Your DMA is really large so this might turn out to just happen to
> > > >> work but note that the primary problem here is that you put a zone
> > > >> restriction for your allocations.
> > > >>
> > > >>> Maybe use vmalloc is a good way, but I don't know the influence.
> > > >>
> > > >> You can have a look at vmalloc patches posted by Andy. They are not 
> > > >> that
> > > >> trivial.
> > > >>
> > > >
> > > > Hi Michal,
> > > >
> > > > Thank you for your comment, could you give me the link?
> > > >
> > >
> > > I've been keeping it mostly up to date in this branch:
> > >
> > > https://git.kernel.org/cgit/linux/kernel/git/luto/linux.git/log/?h=x86/vmap_stack
> > >
> > > It's currently out of sync due to a bunch of the patches being queued
> > > elsewhere for the merge window.
> >
> > Hello, Andy.
> >
> > I have some questions about it.
> >
> > IIUC, to turn on HAVE_ARCH_VMAP_STACK on different architecture, there
> > 

Re: [RFC] can we use vmalloc to alloc thread stack if compaction failed

2016-07-31 Thread Joonsoo Kim
On Fri, Jul 29, 2016 at 12:47:38PM -0700, Andy Lutomirski wrote:
> -- Forwarded message --
> From: "Joonsoo Kim" 
> Date: Jul 28, 2016 7:57 PM
> Subject: Re: [RFC] can we use vmalloc to alloc thread stack if compaction 
> failed
> To: "Andy Lutomirski" 
> Cc: "Xishi Qiu" , "Michal Hocko"
> , "Tejun Heo" , "Ingo Molnar"
> , "Peter Zijlstra" , "LKML"
> , "Linux MM" ,
> "Yisheng Xie" 
> 
> > On Thu, Jul 28, 2016 at 08:07:51AM -0700, Andy Lutomirski wrote:
> > > On Thu, Jul 28, 2016 at 3:51 AM, Xishi Qiu  wrote:
> > > > On 2016/7/28 17:43, Michal Hocko wrote:
> > > >
> > > >> On Thu 28-07-16 16:45:06, Xishi Qiu wrote:
> > > >>> On 2016/7/28 15:58, Michal Hocko wrote:
> > > >>>
> > >  On Thu 28-07-16 15:41:53, Xishi Qiu wrote:
> > > > On 2016/7/28 15:20, Michal Hocko wrote:
> > > >
> > > >> On Thu 28-07-16 15:08:26, Xishi Qiu wrote:
> > > >>> Usually THREAD_SIZE_ORDER is 2, it means we need to alloc 16kb 
> > > >>> continuous
> > > >>> physical memory during fork a new process.
> > > >>>
> > > >>> If the system's memory is very small, especially the smart phone, 
> > > >>> maybe there
> > > >>> is only 1G memory. So the free memory is very small and 
> > > >>> compaction is not
> > > >>> always success in slowpath(__alloc_pages_slowpath), then alloc 
> > > >>> thread stack
> > > >>> may be failed for memory fragment.
> > > >>
> > > >> Well, with the current implementation of the page allocator those
> > > >> requests will not fail in most cases. The oom killer would be 
> > > >> invoked in
> > > >> order to free up some memory.
> > > >>
> > > >
> > > > Hi Michal,
> > > >
> > > > Yes, it success in most cases, but I did have seen this problem in 
> > > > some
> > > > stress-test.
> > > >
> > > > DMA free:470628kB, but alloc 2 order block failed during fork a new 
> > > > process.
> > > > There are so many memory fragments and the large block may be soon 
> > > > taken by
> > > > others after compact because of stress-test.
> > > >
> > > > --- dmesg messages ---
> > > > 07-13 08:41:51.341 
> > > > <4>[309805.658142s][pid:1361,cpu5,sManagerService]sManagerService: 
> > > > page allocation failure: order:2, mode:0x2000d1
> > > 
> > >  Yes but this is __GFP_DMA allocation. I guess you have already 
> > >  reported
> > >  this failure and you've been told that this is quite unexpected for 
> > >  the
> > >  kernel stack allocation. It is your out-of-tree patch which just 
> > >  makes
> > >  things worse because DMA restricted allocations are considered 
> > >  "lowmem"
> > >  and so they do not invoke OOM killer and do not retry like regular
> > >  GFP_KERNEL allocations.
> > > >>>
> > > >>> Hi Michal,
> > > >>>
> > > >>> Yes, we add GFP_DMA, but I don't think this is the key for the 
> > > >>> problem.
> > > >>
> > > >> You are restricting the allocation request to a single zone which is
> > > >> definitely not good. Look at how many larger order pages are available
> > > >> in the Normal zone.
> > > >>
> > > >>> If we do oom-killer, maybe we will get a large block later, but there
> > > >>> is enough free memory before oom(although most of them are fragments).
> > > >>
> > > >> Killing a task is of course the last resort action. It would give you
> > > >> larger order blocks used for the victims thread.
> > > >>
> > > >>> I wonder if we can alloc success without kill any process in this 
> > > >>> situation.
> > > >>
> > > >> Sure it would be preferable to compact that memory but that might be
> > > >> hard with your restriction in place. Consider that DMA zone would tend
> > > >> to be less movable than normal zones as users would have to pin it for
> > > >> DMA. Your DMA is really large so this might turn out to just happen to
> > > >> work but note that the primary problem here is that you put a zone
> > > >> restriction for your allocations.
> > > >>
> > > >>> Maybe use vmalloc is a good way, but I don't know the influence.
> > > >>
> > > >> You can have a look at vmalloc patches posted by Andy. They are not 
> > > >> that
> > > >> trivial.
> > > >>
> > > >
> > > > Hi Michal,
> > > >
> > > > Thank you for your comment, could you give me the link?
> > > >
> > >
> > > I've been keeping it mostly up to date in this branch:
> > >
> > > https://git.kernel.org/cgit/linux/kernel/git/luto/linux.git/log/?h=x86/vmap_stack
> > >
> > > It's currently out of sync due to a bunch of the patches being queued
> > > elsewhere for the merge window.
> >
> > Hello, Andy.
> >
> > I have some questions about it.
> >
> > IIUC, to turn on HAVE_ARCH_VMAP_STACK on different architecture, there
> > is nothing to be done in architecture side if the architecture doesn't
> > support lazily faults in top-level paging entries for the vmalloc
> > area. Is my understanding is correct?
> >
> 
> There should be nothing fundamental that 

Re: [PATCH v2] bpf: silence warnings when building kernel/bpf/core.c with W=1

2016-07-31 Thread Valdis . Kletnieks
On Sun, 31 Jul 2016 21:42:22 -0700, Alexei Starovoitov said:

> and at least 2 other such patches for other files...
> Is there a single warning where -Woverride-init was useful?
> May be worth disabling this warning for the whole build?

There's a few other cases that *aren't* the "define the array to zero
and then build the entries from a list" form.

In particular, there's still 3 odd complaints:

drivers/ata/ahci.c:
drivers/ata/ahci.h:393:16: warning: initialized field overwritten [-Woverride-in
it]
  .can_queue  = AHCI_MAX_CMDS - 1,

drivers/block/drbd/drbd_main.c:
drivers/block/drbd/drbd_main.c:3767:22: warning: initialized field overwritten [
-Woverride-init]
   [P_RETRY_WRITE]  = "retry_write",

arch/x86/kernel/cpu/common.c:
./arch/x86/include/asm/page_64_types.h:22:21: warning: initialized field overwri
tten [-Woverride-init]
 #define DEBUG_STKSZ (PAGE_SIZE << DEBUG_STACK_ORDER)

The point of these patches is to make -Woverride-init *useful* - you'll never
spot 3 warnings in a flood of over 9,000 understood-and-ignored warnings.

Get rid of the 9,000 understood-and-ignored warnings, and then things that
probably *should* be looked at can be noticed.



pgpbgJVRnvWLC.pgp
Description: PGP signature


Re: [PATCH v2] bpf: silence warnings when building kernel/bpf/core.c with W=1

2016-07-31 Thread Valdis . Kletnieks
On Sun, 31 Jul 2016 21:42:22 -0700, Alexei Starovoitov said:

> and at least 2 other such patches for other files...
> Is there a single warning where -Woverride-init was useful?
> May be worth disabling this warning for the whole build?

There's a few other cases that *aren't* the "define the array to zero
and then build the entries from a list" form.

In particular, there's still 3 odd complaints:

drivers/ata/ahci.c:
drivers/ata/ahci.h:393:16: warning: initialized field overwritten [-Woverride-in
it]
  .can_queue  = AHCI_MAX_CMDS - 1,

drivers/block/drbd/drbd_main.c:
drivers/block/drbd/drbd_main.c:3767:22: warning: initialized field overwritten [
-Woverride-init]
   [P_RETRY_WRITE]  = "retry_write",

arch/x86/kernel/cpu/common.c:
./arch/x86/include/asm/page_64_types.h:22:21: warning: initialized field overwri
tten [-Woverride-init]
 #define DEBUG_STKSZ (PAGE_SIZE << DEBUG_STACK_ORDER)

The point of these patches is to make -Woverride-init *useful* - you'll never
spot 3 warnings in a flood of over 9,000 understood-and-ignored warnings.

Get rid of the 9,000 understood-and-ignored warnings, and then things that
probably *should* be looked at can be noticed.



pgpbgJVRnvWLC.pgp
Description: PGP signature


Re:mips builds failing in v3.18.38 and v4.1.29

2016-07-31 Thread 陈华才
Hi,

I have already told Sasha that "MIPS: Reserve nosave data for hibernation" 
should not be backported to 4.1/3.18. But he has no response.

Huacai
 
-- Original --
From:  "Guenter Roeck";
Date:  Mon, Aug 1, 2016 07:57 AM
To:  "Sasha Levin";
Cc:  "stable"; 
"linux-kernel@vger.kernel.org"; "Huacai 
Chen";
Subject:  mips builds failing in v3.18.38 and v4.1.29
 
Sorry I didn't notice earlier - my 3.18/4.1 build scripts were broken.

arch/mips/kernel/setup.c: In function 'arch_mem_init':
arch/mips/kernel/setup.c:689:2: error: implicit declaration of function 
'reserve_bootmem_region'

Offending commit is 1dd0964204277108e ("MIPS: Reserve nosave data for 
hibernation").
It fixes a bug which does not exist in 3.18 / 4.1, in turn causing all mips 
builds in 3.18
and 4.1 to fail.

Guenter

Re:mips builds failing in v3.18.38 and v4.1.29

2016-07-31 Thread 陈华才
Hi,

I have already told Sasha that "MIPS: Reserve nosave data for hibernation" 
should not be backported to 4.1/3.18. But he has no response.

Huacai
 
-- Original --
From:  "Guenter Roeck";
Date:  Mon, Aug 1, 2016 07:57 AM
To:  "Sasha Levin";
Cc:  "stable"; 
"linux-kernel@vger.kernel.org"; "Huacai 
Chen";
Subject:  mips builds failing in v3.18.38 and v4.1.29
 
Sorry I didn't notice earlier - my 3.18/4.1 build scripts were broken.

arch/mips/kernel/setup.c: In function 'arch_mem_init':
arch/mips/kernel/setup.c:689:2: error: implicit declaration of function 
'reserve_bootmem_region'

Offending commit is 1dd0964204277108e ("MIPS: Reserve nosave data for 
hibernation").
It fixes a bug which does not exist in 3.18 / 4.1, in turn causing all mips 
builds in 3.18
and 4.1 to fail.

Guenter

Re: [PATCH 4/4] x86/efi: Allocate a trampoline if needed in efi_free_boot_services()

2016-07-31 Thread H. Peter Anvin
On 07/26/16 15:55, Andy Lutomirski wrote:
> + /*
> +  * Nasty quirk: if all sub-1MB memory is used for boot
> +  * services, we can get here without having allocated the
> +  * real mode trampoline.  It's too late to hand boot services
> +  * memory back to the memblock allocator, so instead
> +  * try to reclaim a single page if needed.
> +  *

This comment makes no sense.  Nowhere is there a dependency on a single
page, and this refers to allocation, not reclaim...

-hpa




Re: [PATCH 4/4] x86/efi: Allocate a trampoline if needed in efi_free_boot_services()

2016-07-31 Thread H. Peter Anvin
On 07/26/16 15:55, Andy Lutomirski wrote:
> + /*
> +  * Nasty quirk: if all sub-1MB memory is used for boot
> +  * services, we can get here without having allocated the
> +  * real mode trampoline.  It's too late to hand boot services
> +  * memory back to the memblock allocator, so instead
> +  * try to reclaim a single page if needed.
> +  *

This comment makes no sense.  Nowhere is there a dependency on a single
page, and this refers to allocation, not reclaim...

-hpa




Re: [ANNOUNCE] git-series: track changes to a patch series over time

2016-07-31 Thread Christian Couder
On Fri, Jul 29, 2016 at 12:10 PM, Richard Ipsum
 wrote:
> On Thu, Jul 28, 2016 at 11:40:55PM -0700, Josh Triplett wrote:
> [snip]
>>
>> I'd welcome any feedback, whether on the interface and workflow, the
>> internals and collaboration, ideas on presenting diffs of patch series,
>> or anything else.
>
> This looks awesome!
>
> I've been working on some similar stuff for a while also.[1][2]
>
> I'm particularly interested in trying to establish a standard for
> storing review data in git. I've got a prototype for doing that[3],
> and an example tool that uses it[4]. The tool is still incomplete/buggy 
> though.

There is also git-appraise (https://github.com/google/git-appraise)
written in Go to store code review data in Git.
It looks like it stores its data in git notes and can be integrated
with Rust (https://github.com/Nemo157/git-appraise-rs).

> There seem to be a number of us trying to solve this in our different ways,
> it would be great to coordinate our efforts.

Yeah, I agree.


Re: [ANNOUNCE] git-series: track changes to a patch series over time

2016-07-31 Thread Christian Couder
On Fri, Jul 29, 2016 at 12:10 PM, Richard Ipsum
 wrote:
> On Thu, Jul 28, 2016 at 11:40:55PM -0700, Josh Triplett wrote:
> [snip]
>>
>> I'd welcome any feedback, whether on the interface and workflow, the
>> internals and collaboration, ideas on presenting diffs of patch series,
>> or anything else.
>
> This looks awesome!
>
> I've been working on some similar stuff for a while also.[1][2]
>
> I'm particularly interested in trying to establish a standard for
> storing review data in git. I've got a prototype for doing that[3],
> and an example tool that uses it[4]. The tool is still incomplete/buggy 
> though.

There is also git-appraise (https://github.com/google/git-appraise)
written in Go to store code review data in Git.
It looks like it stores its data in git notes and can be integrated
with Rust (https://github.com/Nemo157/git-appraise-rs).

> There seem to be a number of us trying to solve this in our different ways,
> it would be great to coordinate our efforts.

Yeah, I agree.


Re: [PATCH 1/3] drm: bridge: add DesignWare HDMI I2S audio support

2016-07-31 Thread Kuninori Morimoto

Hi Jose
Cc: Mark, Thierry, Daniel

> > From: Kuninori Morimoto 
> >
> > Current dw-hdmi is supporting sound via AHB bus, but it has
> > I2S audio feature too. This patch adds I2S audio support to dw-hdmi.
> > This HDMI I2S is supported by using ALSA SoC common HDMI encoder
> > driver.
> >
> > Signed-off-by: Kuninori Morimoto 
> > ---
> >
> 
> I just tested this patch and everything seems ok. Should I give
> my tested-by?

Thank you for your test. I'm happy if it could have it.

Mark, Thierry, Daniel
I wonder who can be maintainer for this patch ??

Best regards
---
Kuninori Morimoto


Re: [PATCH 1/3] drm: bridge: add DesignWare HDMI I2S audio support

2016-07-31 Thread Kuninori Morimoto

Hi Jose
Cc: Mark, Thierry, Daniel

> > From: Kuninori Morimoto 
> >
> > Current dw-hdmi is supporting sound via AHB bus, but it has
> > I2S audio feature too. This patch adds I2S audio support to dw-hdmi.
> > This HDMI I2S is supported by using ALSA SoC common HDMI encoder
> > driver.
> >
> > Signed-off-by: Kuninori Morimoto 
> > ---
> >
> 
> I just tested this patch and everything seems ok. Should I give
> my tested-by?

Thank you for your test. I'm happy if it could have it.

Mark, Thierry, Daniel
I wonder who can be maintainer for this patch ??

Best regards
---
Kuninori Morimoto


Re: [PATCH 1/1] x86/entry: spell EBX register correctly in documentation

2016-07-31 Thread Borislav Petkov
On Fri, Jul 29, 2016 at 01:39:51PM +0200, Nicolas Iooss wrote:
> As EBS does not mean anything reasonable in the context it is used, it
> seems like a misspelling for EBX.
> 
> Signed-off-by: Nicolas Iooss 
> ---
>  arch/x86/entry/entry_64.S | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
> index b846875aeea6..6f3076302017 100644
> --- a/arch/x86/entry/entry_64.S
> +++ b/arch/x86/entry/entry_64.S
> @@ -1058,7 +1058,7 @@ END(error_entry)
>  
>  
>  /*
> - * On entry, EBS is a "return to kernel mode" flag:
> + * On entry, EBX is a "return to kernel mode" flag:
>   *   1: already in kernel mode, don't need SWAPGS
>   *   0: user gsbase is loaded, we need SWAPGS and standard preparation for 
> return to usermode
>   */
> -- 

Acked-by: Borislav Petkov 

-- 
Regards/Gruss,
Boris.

ECO tip #101: Trim your mails when you reply.
--


Re: [PATCH 1/1] x86/entry: spell EBX register correctly in documentation

2016-07-31 Thread Borislav Petkov
On Fri, Jul 29, 2016 at 01:39:51PM +0200, Nicolas Iooss wrote:
> As EBS does not mean anything reasonable in the context it is used, it
> seems like a misspelling for EBX.
> 
> Signed-off-by: Nicolas Iooss 
> ---
>  arch/x86/entry/entry_64.S | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
> index b846875aeea6..6f3076302017 100644
> --- a/arch/x86/entry/entry_64.S
> +++ b/arch/x86/entry/entry_64.S
> @@ -1058,7 +1058,7 @@ END(error_entry)
>  
>  
>  /*
> - * On entry, EBS is a "return to kernel mode" flag:
> + * On entry, EBX is a "return to kernel mode" flag:
>   *   1: already in kernel mode, don't need SWAPGS
>   *   0: user gsbase is loaded, we need SWAPGS and standard preparation for 
> return to usermode
>   */
> -- 

Acked-by: Borislav Petkov 

-- 
Regards/Gruss,
Boris.

ECO tip #101: Trim your mails when you reply.
--


Re: [PATCH v2] bpf: silence warnings when building kernel/bpf/core.c with W=1

2016-07-31 Thread Alexei Starovoitov
On Mon, Aug 01, 2016 at 12:33:30AM -0400, Valdis Kletnieks wrote:
> Building with W=1 generates some 350 lines of warnings of the form:
> 
> kernel/bpf/core.c: In function '__bpf_prog_run':
> kernel/bpf/core.c:476:33: warning: initialized field overwritten 
> [-Woverride-init]
>[BPF_ALU | BPF_ADD | BPF_X] = &_ADD_X,
>  ^~
> kernel/bpf/core.c:476:33: note: (near initialization for 'jumptable[12]')
> 
> Since they come from the way we intentionally build the table, silence
> that one specific warning.
> 
> Signed-off-by: Valdis Kletnieks 
> 
> Version 2: Add bpf: subsystem tag to subject line
> 
> diff --git a/kernel/bpf/Makefile b/kernel/bpf/Makefile
> index eed911d091da..bb915f9d9f92 100644
> --- a/kernel/bpf/Makefile
> +++ b/kernel/bpf/Makefile
> @@ -1,3 +1,4 @@
> +CFLAGS_core.o += -Wno-override-init

and at least 2 other such patches for other files...
Is there a single warning where -Woverride-init was useful?
May be worth disabling this warning for the whole build?



Re: [PATCH v2] bpf: silence warnings when building kernel/bpf/core.c with W=1

2016-07-31 Thread Alexei Starovoitov
On Mon, Aug 01, 2016 at 12:33:30AM -0400, Valdis Kletnieks wrote:
> Building with W=1 generates some 350 lines of warnings of the form:
> 
> kernel/bpf/core.c: In function '__bpf_prog_run':
> kernel/bpf/core.c:476:33: warning: initialized field overwritten 
> [-Woverride-init]
>[BPF_ALU | BPF_ADD | BPF_X] = &_ADD_X,
>  ^~
> kernel/bpf/core.c:476:33: note: (near initialization for 'jumptable[12]')
> 
> Since they come from the way we intentionally build the table, silence
> that one specific warning.
> 
> Signed-off-by: Valdis Kletnieks 
> 
> Version 2: Add bpf: subsystem tag to subject line
> 
> diff --git a/kernel/bpf/Makefile b/kernel/bpf/Makefile
> index eed911d091da..bb915f9d9f92 100644
> --- a/kernel/bpf/Makefile
> +++ b/kernel/bpf/Makefile
> @@ -1,3 +1,4 @@
> +CFLAGS_core.o += -Wno-override-init

and at least 2 other such patches for other files...
Is there a single warning where -Woverride-init was useful?
May be worth disabling this warning for the whole build?



[PATCH v2] bpf: silence warnings when building kernel/bpf/core.c with W=1

2016-07-31 Thread Valdis Kletnieks
Building with W=1 generates some 350 lines of warnings of the form:

kernel/bpf/core.c: In function '__bpf_prog_run':
kernel/bpf/core.c:476:33: warning: initialized field overwritten 
[-Woverride-init]
   [BPF_ALU | BPF_ADD | BPF_X] = &_ADD_X,
 ^~
kernel/bpf/core.c:476:33: note: (near initialization for 'jumptable[12]')

Since they come from the way we intentionally build the table, silence
that one specific warning.

Signed-off-by: Valdis Kletnieks 

Version 2: Add bpf: subsystem tag to subject line

diff --git a/kernel/bpf/Makefile b/kernel/bpf/Makefile
index eed911d091da..bb915f9d9f92 100644
--- a/kernel/bpf/Makefile
+++ b/kernel/bpf/Makefile
@@ -1,3 +1,4 @@
+CFLAGS_core.o += -Wno-override-init
 obj-y := core.o
 
 obj-$(CONFIG_BPF_SYSCALL) += syscall.o verifier.o inode.o helpers.o





[PATCH v2] bpf: silence warnings when building kernel/bpf/core.c with W=1

2016-07-31 Thread Valdis Kletnieks
Building with W=1 generates some 350 lines of warnings of the form:

kernel/bpf/core.c: In function '__bpf_prog_run':
kernel/bpf/core.c:476:33: warning: initialized field overwritten 
[-Woverride-init]
   [BPF_ALU | BPF_ADD | BPF_X] = &_ADD_X,
 ^~
kernel/bpf/core.c:476:33: note: (near initialization for 'jumptable[12]')

Since they come from the way we intentionally build the table, silence
that one specific warning.

Signed-off-by: Valdis Kletnieks 

Version 2: Add bpf: subsystem tag to subject line

diff --git a/kernel/bpf/Makefile b/kernel/bpf/Makefile
index eed911d091da..bb915f9d9f92 100644
--- a/kernel/bpf/Makefile
+++ b/kernel/bpf/Makefile
@@ -1,3 +1,4 @@
+CFLAGS_core.o += -Wno-override-init
 obj-y := core.o
 
 obj-$(CONFIG_BPF_SYSCALL) += syscall.o verifier.o inode.o helpers.o





[PATCH 1/2 v4] perf sched: fix wrong conversion of task state

2016-07-31 Thread Tomoki Sekiyama
Currently sched_out_state() converts the prev_state u64 bitmask to a char
using the bitmask as an index, which may cause invalid memory access.
This fixes the issue by using the __ffs() returned value as an index.

Signed-off-by: Tomoki Sekiyama 
Fixes: cdce9d738b91e ("perf sched: Add sched latency profiling")
Cc: Jiri Olsa 
Cc: David Ahern 
Cc: Namhyung Kim 
Cc: Peter Zijlstra 
Cc: Masami Hiramatsu 
---
Changes from v3:
  Added Fixes:
  Split the patch into 2 pieces.

 tools/perf/builtin-sched.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index 0dfe8df..ce9bef6 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -897,9 +897,10 @@ static int thread_atoms_insert(struct perf_sched *sched, 
struct thread *thread)
 
 static char sched_out_state(u64 prev_state)
 {
-   const char *str = TASK_STATE_TO_CHAR_STR;
+   const char str[] = TASK_STATE_TO_CHAR_STR;
+   unsigned int bit = prev_state ? __ffs(prev_state) + 1 : 0;
 
-   return str[prev_state];
+   return bit < ARRAY_SIZE(str) - 1 ? str[bit] : '?';
 }
 
 static int
-- 
2.7.4



[PATCH 2/2 v4] perf sched: adapt TASK_STATE_TO_CHAR_STR to the latest kernel

2016-07-31 Thread Tomoki Sekiyama
Update TASK_STATE_TO_CHAR_STR macro to one from sched.h in the latest
kernel, where 'N' and 'n' are introduced, 'X' and 'Z' are swapped.

Signed-off-by: Tomoki Sekiyama 
Fixes: cdce9d738b91e ("perf sched: Add sched latency profiling")
Cc: Jiri Olsa 
Cc: David Ahern 
Cc: Namhyung Kim 
Cc: Peter Zijlstra 
Cc: Masami Hiramatsu 
---
Changes from v3:
  Added Fixes:
  Split patch into 2 pieces.

 tools/perf/builtin-sched.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index ce9bef6..5776263 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -70,7 +70,7 @@ struct sched_atom {
struct task_desc*wakee;
 };
 
-#define TASK_STATE_TO_CHAR_STR "RSDTtZXxKWP"
+#define TASK_STATE_TO_CHAR_STR "RSDTtXZxKWPNn"
 
 enum thread_state {
THREAD_SLEEPING = 0,
-- 
2.7.4



RE: [PATCH v5 6/8] thunderbolt: Networking transmit and receive

2016-07-31 Thread Levy, Amir (Jer)
On Sun, Jul 31 2016, 09:45 PM, David Miller wrote:
> From: "Levy, Amir (Jer)" 
> Date: Sun, 31 Jul 2016 10:15:52 +
> 
> > The network stack thinks it is Ethernet, it might not accept Runt
> > frames, so the driver pads the frame in receive.
> 
> The network stack doesn't care about this at all.  It's wasted effort on your
> part.

Great, I'll remove this code.


[PATCH 1/2 v4] perf sched: fix wrong conversion of task state

2016-07-31 Thread Tomoki Sekiyama
Currently sched_out_state() converts the prev_state u64 bitmask to a char
using the bitmask as an index, which may cause invalid memory access.
This fixes the issue by using the __ffs() returned value as an index.

Signed-off-by: Tomoki Sekiyama 
Fixes: cdce9d738b91e ("perf sched: Add sched latency profiling")
Cc: Jiri Olsa 
Cc: David Ahern 
Cc: Namhyung Kim 
Cc: Peter Zijlstra 
Cc: Masami Hiramatsu 
---
Changes from v3:
  Added Fixes:
  Split the patch into 2 pieces.

 tools/perf/builtin-sched.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index 0dfe8df..ce9bef6 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -897,9 +897,10 @@ static int thread_atoms_insert(struct perf_sched *sched, 
struct thread *thread)
 
 static char sched_out_state(u64 prev_state)
 {
-   const char *str = TASK_STATE_TO_CHAR_STR;
+   const char str[] = TASK_STATE_TO_CHAR_STR;
+   unsigned int bit = prev_state ? __ffs(prev_state) + 1 : 0;
 
-   return str[prev_state];
+   return bit < ARRAY_SIZE(str) - 1 ? str[bit] : '?';
 }
 
 static int
-- 
2.7.4



[PATCH 2/2 v4] perf sched: adapt TASK_STATE_TO_CHAR_STR to the latest kernel

2016-07-31 Thread Tomoki Sekiyama
Update TASK_STATE_TO_CHAR_STR macro to one from sched.h in the latest
kernel, where 'N' and 'n' are introduced, 'X' and 'Z' are swapped.

Signed-off-by: Tomoki Sekiyama 
Fixes: cdce9d738b91e ("perf sched: Add sched latency profiling")
Cc: Jiri Olsa 
Cc: David Ahern 
Cc: Namhyung Kim 
Cc: Peter Zijlstra 
Cc: Masami Hiramatsu 
---
Changes from v3:
  Added Fixes:
  Split patch into 2 pieces.

 tools/perf/builtin-sched.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index ce9bef6..5776263 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -70,7 +70,7 @@ struct sched_atom {
struct task_desc*wakee;
 };
 
-#define TASK_STATE_TO_CHAR_STR "RSDTtZXxKWP"
+#define TASK_STATE_TO_CHAR_STR "RSDTtXZxKWPNn"
 
 enum thread_state {
THREAD_SLEEPING = 0,
-- 
2.7.4



RE: [PATCH v5 6/8] thunderbolt: Networking transmit and receive

2016-07-31 Thread Levy, Amir (Jer)
On Sun, Jul 31 2016, 09:45 PM, David Miller wrote:
> From: "Levy, Amir (Jer)" 
> Date: Sun, 31 Jul 2016 10:15:52 +
> 
> > The network stack thinks it is Ethernet, it might not accept Runt
> > frames, so the driver pads the frame in receive.
> 
> The network stack doesn't care about this at all.  It's wasted effort on your
> part.

Great, I'll remove this code.


[RESEND PATCH 0/6] fix and optimize some clock configuration for the RK3399 platfom

2016-07-31 Thread Xing Zheng

Hi:
  In the development work, we found that some of the previous
incorrect clock configuration on the RK3399 platform, we should
fix and optimize them.


Elaine Zhang (1):
  clk: rockchip: rk3399: delete the CLK_IGNORE_UNUSED for aclk_pcie

Xing Zheng (5):
  clk: rockchip: rk3399: export USBPHYx_480M_SRC clock IDs
  clk: rockchip: rk3399: export 480M_SRC clock id for usbphy0/usbphy1
  clk: rockchip: rk3399: fix incorrect aclk_emmc source gate bits
  clk: rockchip: rk3399: add 65MHz and 106.5MHz clocks for HDMI
  clk: rockchip: rk3399: Add support frac mode frequencies

 drivers/clk/rockchip/clk-rk3399.c  |   35 +---
 include/dt-bindings/clock/rk3399-cru.h |2 ++
 2 files changed, 30 insertions(+), 7 deletions(-)

-- 
1.7.9.5




[RESEND PATCH 6/6] clk: rockchip: rk3399: Add support frac mode frequencies

2016-07-31 Thread Xing Zheng
We need to support various display resolutions for external
display devices like HDMI/DP, the frac mode can help us to
acquire almost any frequencies, and need higher VCOs to reduce
clock jitters.

Signed-off-by: Xing Zheng 
---

 drivers/clk/rockchip/clk-rk3399.c |   21 -
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/rockchip/clk-rk3399.c 
b/drivers/clk/rockchip/clk-rk3399.c
index 4a15ce5b..3daa164 100644
--- a/drivers/clk/rockchip/clk-rk3399.c
+++ b/drivers/clk/rockchip/clk-rk3399.c
@@ -109,6 +109,25 @@ static struct rockchip_pll_rate_table rk3399_pll_rates[] = 
{
{ /* sentinel */ },
 };
 
+static struct rockchip_pll_rate_table rk3399_pll_frates[] = {
+   /* _mhz, _refdiv, _fbdiv, _postdiv1, _postdiv2, _dsmpd, _frac */
+   RK3036_PLL_RATE( 59400, 1, 123, 5, 1, 0, 12582912),  /* vco = 
297000 */
+   RK3036_PLL_RATE( 593406593, 1, 123, 5, 1, 0, 10508804),  /* vco = 
2967032965 */
+   RK3036_PLL_RATE( 29700, 1, 123, 5, 2, 0, 12582912),  /* vco = 
297000 */
+   RK3036_PLL_RATE( 296703297, 1, 123, 5, 2, 0, 10508807),  /* vco = 
2967032970 */
+   RK3036_PLL_RATE( 14850, 1, 129, 7, 3, 0, 15728640),  /* vco = 
311850 */
+   RK3036_PLL_RATE( 148351648, 1, 123, 5, 4, 0, 10508800),  /* vco = 
2967032960 */
+   RK3036_PLL_RATE( 10650, 1, 124, 7, 4, 0,  4194304),  /* vco = 
298200 */
+   RK3036_PLL_RATE(  7425, 1, 129, 7, 6, 0, 15728640),  /* vco = 
311850 */
+   RK3036_PLL_RATE(  74175824, 1, 129, 7, 6, 0, 13550823),  /* vco = 
3115384608 */
+   RK3036_PLL_RATE(  6500, 1, 113, 7, 6, 0, 12582912),  /* vco = 
273000 */
+   RK3036_PLL_RATE(  59340659, 1, 121, 7, 7, 0,  2581098),  /* vco = 
2907692291 */
+   RK3036_PLL_RATE(  5400, 1, 110, 7, 7, 0,  4194304),  /* vco = 
264600 */
+   RK3036_PLL_RATE(  2700, 1,  55, 7, 7, 0,  2097152),  /* vco = 
132300 */
+   RK3036_PLL_RATE(  26973027, 1,  55, 7, 7, 0,  1173232),  /* vco = 
1321678323 */
+   { /* sentinel */ },
+};
+
 /* CRU parents */
 PNAME(mux_pll_p)   = { "xin24m", "xin32k" };
 
@@ -229,7 +248,7 @@ static struct rockchip_pll_clock rk3399_pll_clks[] 
__initdata = {
[npll] = PLL(pll_rk3399, PLL_NPLL, "npll",  mux_pll_p, 0, 
RK3399_PLL_CON(40),
 RK3399_PLL_CON(43), 8, 31, ROCKCHIP_PLL_SYNC_RATE, 
rk3399_pll_rates),
[vpll] = PLL(pll_rk3399, PLL_VPLL, "vpll",  mux_pll_p, 0, 
RK3399_PLL_CON(48),
-RK3399_PLL_CON(51), 8, 31, ROCKCHIP_PLL_SYNC_RATE, 
rk3399_pll_rates),
+RK3399_PLL_CON(51), 8, 31, ROCKCHIP_PLL_SYNC_RATE, 
rk3399_pll_frates),
 };
 
 static struct rockchip_pll_clock rk3399_pmu_pll_clks[] __initdata = {
-- 
1.7.9.5




[RESEND PATCH 1/6] clk: rockchip: rk3399: export USBPHYx_480M_SRC clock IDs

2016-07-31 Thread Xing Zheng
We export some clock IDs for the usb phy 480m source clocks.

Signed-off-by: Xing Zheng 

---

 include/dt-bindings/clock/rk3399-cru.h |2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/dt-bindings/clock/rk3399-cru.h 
b/include/dt-bindings/clock/rk3399-cru.h
index 50a44cf..c4d8311 100644
--- a/include/dt-bindings/clock/rk3399-cru.h
+++ b/include/dt-bindings/clock/rk3399-cru.h
@@ -131,6 +131,8 @@
 #define SCLK_DPHY_RX0_CFG  165
 #define SCLK_RMII_SRC  166
 #define SCLK_PCIEPHY_REF100M   167
+#define SCLK_USBPHY0_480M_SRC  168
+#define SCLK_USBPHY1_480M_SRC  169
 
 #define DCLK_VOP0  180
 #define DCLK_VOP1  181
-- 
1.7.9.5




[RESEND PATCH 3/6] clk: rockchip: rk3399: fix incorrect aclk_emmc source gate bits

2016-07-31 Thread Xing Zheng
Dues to incorrect diagram, we need to fix incorrect bits for
(c/g)pll_aclk_emmc_src:
cpll_aclk_emmc_src --> G6[13]
gpll_aclk_emmc_src --> G6[12]

Signed-off-by: Xing Zheng 
---

 drivers/clk/rockchip/clk-rk3399.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/rockchip/clk-rk3399.c 
b/drivers/clk/rockchip/clk-rk3399.c
index f55f967f..ad3860a 100644
--- a/drivers/clk/rockchip/clk-rk3399.c
+++ b/drivers/clk/rockchip/clk-rk3399.c
@@ -923,9 +923,9 @@ static struct rockchip_clk_branch rk3399_clk_branches[] 
__initdata = {
RK3399_CLKGATE_CON(6), 14, GFLAGS),
 
GATE(0, "cpll_aclk_emmc_src", "cpll", CLK_IGNORE_UNUSED,
-   RK3399_CLKGATE_CON(6), 12, GFLAGS),
-   GATE(0, "gpll_aclk_emmc_src", "gpll", CLK_IGNORE_UNUSED,
RK3399_CLKGATE_CON(6), 13, GFLAGS),
+   GATE(0, "gpll_aclk_emmc_src", "gpll", CLK_IGNORE_UNUSED,
+   RK3399_CLKGATE_CON(6), 12, GFLAGS),
COMPOSITE_NOGATE(ACLK_EMMC, "aclk_emmc", mux_aclk_emmc_p, 
CLK_IGNORE_UNUSED,
RK3399_CLKSEL_CON(21), 7, 1, MFLAGS, 0, 5, DFLAGS),
GATE(ACLK_EMMC_CORE, "aclk_emmccore", "aclk_emmc", CLK_IGNORE_UNUSED,
-- 
1.7.9.5




[RESEND PATCH 0/6] fix and optimize some clock configuration for the RK3399 platfom

2016-07-31 Thread Xing Zheng

Hi:
  In the development work, we found that some of the previous
incorrect clock configuration on the RK3399 platform, we should
fix and optimize them.


Elaine Zhang (1):
  clk: rockchip: rk3399: delete the CLK_IGNORE_UNUSED for aclk_pcie

Xing Zheng (5):
  clk: rockchip: rk3399: export USBPHYx_480M_SRC clock IDs
  clk: rockchip: rk3399: export 480M_SRC clock id for usbphy0/usbphy1
  clk: rockchip: rk3399: fix incorrect aclk_emmc source gate bits
  clk: rockchip: rk3399: add 65MHz and 106.5MHz clocks for HDMI
  clk: rockchip: rk3399: Add support frac mode frequencies

 drivers/clk/rockchip/clk-rk3399.c  |   35 +---
 include/dt-bindings/clock/rk3399-cru.h |2 ++
 2 files changed, 30 insertions(+), 7 deletions(-)

-- 
1.7.9.5




[RESEND PATCH 6/6] clk: rockchip: rk3399: Add support frac mode frequencies

2016-07-31 Thread Xing Zheng
We need to support various display resolutions for external
display devices like HDMI/DP, the frac mode can help us to
acquire almost any frequencies, and need higher VCOs to reduce
clock jitters.

Signed-off-by: Xing Zheng 
---

 drivers/clk/rockchip/clk-rk3399.c |   21 -
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/rockchip/clk-rk3399.c 
b/drivers/clk/rockchip/clk-rk3399.c
index 4a15ce5b..3daa164 100644
--- a/drivers/clk/rockchip/clk-rk3399.c
+++ b/drivers/clk/rockchip/clk-rk3399.c
@@ -109,6 +109,25 @@ static struct rockchip_pll_rate_table rk3399_pll_rates[] = 
{
{ /* sentinel */ },
 };
 
+static struct rockchip_pll_rate_table rk3399_pll_frates[] = {
+   /* _mhz, _refdiv, _fbdiv, _postdiv1, _postdiv2, _dsmpd, _frac */
+   RK3036_PLL_RATE( 59400, 1, 123, 5, 1, 0, 12582912),  /* vco = 
297000 */
+   RK3036_PLL_RATE( 593406593, 1, 123, 5, 1, 0, 10508804),  /* vco = 
2967032965 */
+   RK3036_PLL_RATE( 29700, 1, 123, 5, 2, 0, 12582912),  /* vco = 
297000 */
+   RK3036_PLL_RATE( 296703297, 1, 123, 5, 2, 0, 10508807),  /* vco = 
2967032970 */
+   RK3036_PLL_RATE( 14850, 1, 129, 7, 3, 0, 15728640),  /* vco = 
311850 */
+   RK3036_PLL_RATE( 148351648, 1, 123, 5, 4, 0, 10508800),  /* vco = 
2967032960 */
+   RK3036_PLL_RATE( 10650, 1, 124, 7, 4, 0,  4194304),  /* vco = 
298200 */
+   RK3036_PLL_RATE(  7425, 1, 129, 7, 6, 0, 15728640),  /* vco = 
311850 */
+   RK3036_PLL_RATE(  74175824, 1, 129, 7, 6, 0, 13550823),  /* vco = 
3115384608 */
+   RK3036_PLL_RATE(  6500, 1, 113, 7, 6, 0, 12582912),  /* vco = 
273000 */
+   RK3036_PLL_RATE(  59340659, 1, 121, 7, 7, 0,  2581098),  /* vco = 
2907692291 */
+   RK3036_PLL_RATE(  5400, 1, 110, 7, 7, 0,  4194304),  /* vco = 
264600 */
+   RK3036_PLL_RATE(  2700, 1,  55, 7, 7, 0,  2097152),  /* vco = 
132300 */
+   RK3036_PLL_RATE(  26973027, 1,  55, 7, 7, 0,  1173232),  /* vco = 
1321678323 */
+   { /* sentinel */ },
+};
+
 /* CRU parents */
 PNAME(mux_pll_p)   = { "xin24m", "xin32k" };
 
@@ -229,7 +248,7 @@ static struct rockchip_pll_clock rk3399_pll_clks[] 
__initdata = {
[npll] = PLL(pll_rk3399, PLL_NPLL, "npll",  mux_pll_p, 0, 
RK3399_PLL_CON(40),
 RK3399_PLL_CON(43), 8, 31, ROCKCHIP_PLL_SYNC_RATE, 
rk3399_pll_rates),
[vpll] = PLL(pll_rk3399, PLL_VPLL, "vpll",  mux_pll_p, 0, 
RK3399_PLL_CON(48),
-RK3399_PLL_CON(51), 8, 31, ROCKCHIP_PLL_SYNC_RATE, 
rk3399_pll_rates),
+RK3399_PLL_CON(51), 8, 31, ROCKCHIP_PLL_SYNC_RATE, 
rk3399_pll_frates),
 };
 
 static struct rockchip_pll_clock rk3399_pmu_pll_clks[] __initdata = {
-- 
1.7.9.5




[RESEND PATCH 1/6] clk: rockchip: rk3399: export USBPHYx_480M_SRC clock IDs

2016-07-31 Thread Xing Zheng
We export some clock IDs for the usb phy 480m source clocks.

Signed-off-by: Xing Zheng 

---

 include/dt-bindings/clock/rk3399-cru.h |2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/dt-bindings/clock/rk3399-cru.h 
b/include/dt-bindings/clock/rk3399-cru.h
index 50a44cf..c4d8311 100644
--- a/include/dt-bindings/clock/rk3399-cru.h
+++ b/include/dt-bindings/clock/rk3399-cru.h
@@ -131,6 +131,8 @@
 #define SCLK_DPHY_RX0_CFG  165
 #define SCLK_RMII_SRC  166
 #define SCLK_PCIEPHY_REF100M   167
+#define SCLK_USBPHY0_480M_SRC  168
+#define SCLK_USBPHY1_480M_SRC  169
 
 #define DCLK_VOP0  180
 #define DCLK_VOP1  181
-- 
1.7.9.5




[RESEND PATCH 3/6] clk: rockchip: rk3399: fix incorrect aclk_emmc source gate bits

2016-07-31 Thread Xing Zheng
Dues to incorrect diagram, we need to fix incorrect bits for
(c/g)pll_aclk_emmc_src:
cpll_aclk_emmc_src --> G6[13]
gpll_aclk_emmc_src --> G6[12]

Signed-off-by: Xing Zheng 
---

 drivers/clk/rockchip/clk-rk3399.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/rockchip/clk-rk3399.c 
b/drivers/clk/rockchip/clk-rk3399.c
index f55f967f..ad3860a 100644
--- a/drivers/clk/rockchip/clk-rk3399.c
+++ b/drivers/clk/rockchip/clk-rk3399.c
@@ -923,9 +923,9 @@ static struct rockchip_clk_branch rk3399_clk_branches[] 
__initdata = {
RK3399_CLKGATE_CON(6), 14, GFLAGS),
 
GATE(0, "cpll_aclk_emmc_src", "cpll", CLK_IGNORE_UNUSED,
-   RK3399_CLKGATE_CON(6), 12, GFLAGS),
-   GATE(0, "gpll_aclk_emmc_src", "gpll", CLK_IGNORE_UNUSED,
RK3399_CLKGATE_CON(6), 13, GFLAGS),
+   GATE(0, "gpll_aclk_emmc_src", "gpll", CLK_IGNORE_UNUSED,
+   RK3399_CLKGATE_CON(6), 12, GFLAGS),
COMPOSITE_NOGATE(ACLK_EMMC, "aclk_emmc", mux_aclk_emmc_p, 
CLK_IGNORE_UNUSED,
RK3399_CLKSEL_CON(21), 7, 1, MFLAGS, 0, 5, DFLAGS),
GATE(ACLK_EMMC_CORE, "aclk_emmccore", "aclk_emmc", CLK_IGNORE_UNUSED,
-- 
1.7.9.5




[RESEND PATCH 5/6] clk: rockchip: rk3399: delete the CLK_IGNORE_UNUSED for aclk_pcie

2016-07-31 Thread Xing Zheng
From: Elaine Zhang 

allow aclk_pcie and aclk_perf_pcie disabled when unused.

Signed-off-by: Elaine Zhang 
Signed-off-by: Xing Zheng 

---

 drivers/clk/rockchip/clk-rk3399.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/rockchip/clk-rk3399.c 
b/drivers/clk/rockchip/clk-rk3399.c
index 74afec0..4a15ce5b 100644
--- a/drivers/clk/rockchip/clk-rk3399.c
+++ b/drivers/clk/rockchip/clk-rk3399.c
@@ -848,9 +848,9 @@ static struct rockchip_clk_branch rk3399_clk_branches[] 
__initdata = {
RK3399_CLKSEL_CON(14), 12, 2, DFLAGS,
RK3399_CLKGATE_CON(5), 4, GFLAGS),
 
-   GATE(ACLK_PERF_PCIE, "aclk_perf_pcie", "aclk_perihp", CLK_IGNORE_UNUSED,
+   GATE(ACLK_PERF_PCIE, "aclk_perf_pcie", "aclk_perihp", 0,
RK3399_CLKGATE_CON(20), 2, GFLAGS),
-   GATE(ACLK_PCIE, "aclk_pcie", "aclk_perihp", CLK_IGNORE_UNUSED,
+   GATE(ACLK_PCIE, "aclk_pcie", "aclk_perihp", 0,
RK3399_CLKGATE_CON(20), 10, GFLAGS),
GATE(0, "aclk_perihp_noc", "aclk_perihp", CLK_IGNORE_UNUSED,
RK3399_CLKGATE_CON(20), 12, GFLAGS),
-- 
1.7.9.5




[RESEND PATCH 2/6] clk: rockchip: rk3399: export 480M_SRC clock id for usbphy0/usbphy1

2016-07-31 Thread Xing Zheng
Export these source clocks for usbphy.

Signed-off-by: Xing Zheng 

---

 drivers/clk/rockchip/clk-rk3399.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/rockchip/clk-rk3399.c 
b/drivers/clk/rockchip/clk-rk3399.c
index 78e51cb..f55f967f 100644
--- a/drivers/clk/rockchip/clk-rk3399.c
+++ b/drivers/clk/rockchip/clk-rk3399.c
@@ -403,9 +403,9 @@ static struct rockchip_clk_branch rk3399_clk_branches[] 
__initdata = {
GATE(SCLK_USB2PHY1_REF, "clk_usb2phy1_ref", "xin24m", CLK_IGNORE_UNUSED,
RK3399_CLKGATE_CON(6), 6, GFLAGS),
 
-   GATE(0, "clk_usbphy0_480m_src", "clk_usbphy0_480m", CLK_IGNORE_UNUSED,
+   GATE(SCLK_USBPHY0_480M_SRC, "clk_usbphy0_480m_src", "clk_usbphy0_480m", 
CLK_IGNORE_UNUSED,
RK3399_CLKGATE_CON(13), 12, GFLAGS),
-   GATE(0, "clk_usbphy1_480m_src", "clk_usbphy1_480m", CLK_IGNORE_UNUSED,
+   GATE(SCLK_USBPHY1_480M_SRC, "clk_usbphy1_480m_src", "clk_usbphy1_480m", 
CLK_IGNORE_UNUSED,
RK3399_CLKGATE_CON(13), 12, GFLAGS),
MUX(0, "clk_usbphy_480m", mux_usbphy_480m_p, CLK_IGNORE_UNUSED,
RK3399_CLKSEL_CON(14), 6, 1, MFLAGS),
-- 
1.7.9.5




[RESEND PATCH 2/6] clk: rockchip: rk3399: export 480M_SRC clock id for usbphy0/usbphy1

2016-07-31 Thread Xing Zheng
Export these source clocks for usbphy.

Signed-off-by: Xing Zheng 

---

 drivers/clk/rockchip/clk-rk3399.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/rockchip/clk-rk3399.c 
b/drivers/clk/rockchip/clk-rk3399.c
index 78e51cb..f55f967f 100644
--- a/drivers/clk/rockchip/clk-rk3399.c
+++ b/drivers/clk/rockchip/clk-rk3399.c
@@ -403,9 +403,9 @@ static struct rockchip_clk_branch rk3399_clk_branches[] 
__initdata = {
GATE(SCLK_USB2PHY1_REF, "clk_usb2phy1_ref", "xin24m", CLK_IGNORE_UNUSED,
RK3399_CLKGATE_CON(6), 6, GFLAGS),
 
-   GATE(0, "clk_usbphy0_480m_src", "clk_usbphy0_480m", CLK_IGNORE_UNUSED,
+   GATE(SCLK_USBPHY0_480M_SRC, "clk_usbphy0_480m_src", "clk_usbphy0_480m", 
CLK_IGNORE_UNUSED,
RK3399_CLKGATE_CON(13), 12, GFLAGS),
-   GATE(0, "clk_usbphy1_480m_src", "clk_usbphy1_480m", CLK_IGNORE_UNUSED,
+   GATE(SCLK_USBPHY1_480M_SRC, "clk_usbphy1_480m_src", "clk_usbphy1_480m", 
CLK_IGNORE_UNUSED,
RK3399_CLKGATE_CON(13), 12, GFLAGS),
MUX(0, "clk_usbphy_480m", mux_usbphy_480m_p, CLK_IGNORE_UNUSED,
RK3399_CLKSEL_CON(14), 6, 1, MFLAGS),
-- 
1.7.9.5




[RESEND PATCH 5/6] clk: rockchip: rk3399: delete the CLK_IGNORE_UNUSED for aclk_pcie

2016-07-31 Thread Xing Zheng
From: Elaine Zhang 

allow aclk_pcie and aclk_perf_pcie disabled when unused.

Signed-off-by: Elaine Zhang 
Signed-off-by: Xing Zheng 

---

 drivers/clk/rockchip/clk-rk3399.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/rockchip/clk-rk3399.c 
b/drivers/clk/rockchip/clk-rk3399.c
index 74afec0..4a15ce5b 100644
--- a/drivers/clk/rockchip/clk-rk3399.c
+++ b/drivers/clk/rockchip/clk-rk3399.c
@@ -848,9 +848,9 @@ static struct rockchip_clk_branch rk3399_clk_branches[] 
__initdata = {
RK3399_CLKSEL_CON(14), 12, 2, DFLAGS,
RK3399_CLKGATE_CON(5), 4, GFLAGS),
 
-   GATE(ACLK_PERF_PCIE, "aclk_perf_pcie", "aclk_perihp", CLK_IGNORE_UNUSED,
+   GATE(ACLK_PERF_PCIE, "aclk_perf_pcie", "aclk_perihp", 0,
RK3399_CLKGATE_CON(20), 2, GFLAGS),
-   GATE(ACLK_PCIE, "aclk_pcie", "aclk_perihp", CLK_IGNORE_UNUSED,
+   GATE(ACLK_PCIE, "aclk_pcie", "aclk_perihp", 0,
RK3399_CLKGATE_CON(20), 10, GFLAGS),
GATE(0, "aclk_perihp_noc", "aclk_perihp", CLK_IGNORE_UNUSED,
RK3399_CLKGATE_CON(20), 12, GFLAGS),
-- 
1.7.9.5




[RESEND PATCH 4/6] clk: rockchip: rk3399: add 65MHz and 106.5MHz clocks for HDMI

2016-07-31 Thread Xing Zheng
We need to add more clocks for supporting more display resolution
for HDMI.

Signed-off-by: Xing Zheng 
---

 drivers/clk/rockchip/clk-rk3399.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/clk/rockchip/clk-rk3399.c 
b/drivers/clk/rockchip/clk-rk3399.c
index ad3860a..74afec0 100644
--- a/drivers/clk/rockchip/clk-rk3399.c
+++ b/drivers/clk/rockchip/clk-rk3399.c
@@ -100,8 +100,10 @@ static struct rockchip_pll_rate_table rk3399_pll_rates[] = 
{
RK3036_PLL_RATE( 29700, 1, 99, 4, 2, 1, 0),
RK3036_PLL_RATE( 21600, 1, 72, 4, 2, 1, 0),
RK3036_PLL_RATE( 14850, 1, 99, 4, 4, 1, 0),
+   RK3036_PLL_RATE( 10650, 1, 71, 4, 4, 1, 0),
RK3036_PLL_RATE(  9600, 1, 64, 4, 4, 1, 0),
RK3036_PLL_RATE(  7425, 2, 99, 4, 4, 1, 0),
+   RK3036_PLL_RATE(  6500, 1, 65, 6, 4, 1, 0),
RK3036_PLL_RATE(  5400, 1, 54, 6, 4, 1, 0),
RK3036_PLL_RATE(  2700, 1, 27, 6, 4, 1, 0),
{ /* sentinel */ },
-- 
1.7.9.5




[RESEND PATCH 4/6] clk: rockchip: rk3399: add 65MHz and 106.5MHz clocks for HDMI

2016-07-31 Thread Xing Zheng
We need to add more clocks for supporting more display resolution
for HDMI.

Signed-off-by: Xing Zheng 
---

 drivers/clk/rockchip/clk-rk3399.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/clk/rockchip/clk-rk3399.c 
b/drivers/clk/rockchip/clk-rk3399.c
index ad3860a..74afec0 100644
--- a/drivers/clk/rockchip/clk-rk3399.c
+++ b/drivers/clk/rockchip/clk-rk3399.c
@@ -100,8 +100,10 @@ static struct rockchip_pll_rate_table rk3399_pll_rates[] = 
{
RK3036_PLL_RATE( 29700, 1, 99, 4, 2, 1, 0),
RK3036_PLL_RATE( 21600, 1, 72, 4, 2, 1, 0),
RK3036_PLL_RATE( 14850, 1, 99, 4, 4, 1, 0),
+   RK3036_PLL_RATE( 10650, 1, 71, 4, 4, 1, 0),
RK3036_PLL_RATE(  9600, 1, 64, 4, 4, 1, 0),
RK3036_PLL_RATE(  7425, 2, 99, 4, 4, 1, 0),
+   RK3036_PLL_RATE(  6500, 1, 65, 6, 4, 1, 0),
RK3036_PLL_RATE(  5400, 1, 54, 6, 4, 1, 0),
RK3036_PLL_RATE(  2700, 1, 27, 6, 4, 1, 0),
{ /* sentinel */ },
-- 
1.7.9.5




Re: [PATCH v2 3/3] powerpc: Convert fsl_rstcr_restart to a reset handler

2016-07-31 Thread Nicholas Piggin
On Thu, 28 Jul 2016 16:07:18 -0700
Andrey Smirnov  wrote:

> Convert fsl_rstcr_restart into a function to be registered with
> register_reset_handler().
> 
> Signed-off-by: Andrey Smirnov 
> ---
> 
> Changes since v1:
> 
>   - fsl_rstcr_restart is registered as a reset handler in
>   setup_rstcr, replacing per-board arch_initcall approach

Bear in mind I don't know much about the embedded or platform code!

The documentation for reset notifiers says that they are expected
to be registered from drivers, not arch code. That seems to only be
intended to mean that the standard ISA or platform reset would
normally be handled directly by the arch, whereas if you have an
arch specific driver for a reset hardware that just happens to live
under arch/, then fsl_rstcr_restart / mpc85xx_cds_restart would be
valid use of reset notifier.

So this change seems reasonable to me. One small question:


> +static int mpc85xx_cds_restart_register(void)
> +{
> + static struct notifier_block restart_handler;
> +
> + restart_handler.notifier_call = mpc85xx_cds_restart;
> + restart_handler.priority = 192;

Should there be a header with #define's for these priorities?

Thanks,
Nick


Re: [PATCH v2 3/3] powerpc: Convert fsl_rstcr_restart to a reset handler

2016-07-31 Thread Nicholas Piggin
On Thu, 28 Jul 2016 16:07:18 -0700
Andrey Smirnov  wrote:

> Convert fsl_rstcr_restart into a function to be registered with
> register_reset_handler().
> 
> Signed-off-by: Andrey Smirnov 
> ---
> 
> Changes since v1:
> 
>   - fsl_rstcr_restart is registered as a reset handler in
>   setup_rstcr, replacing per-board arch_initcall approach

Bear in mind I don't know much about the embedded or platform code!

The documentation for reset notifiers says that they are expected
to be registered from drivers, not arch code. That seems to only be
intended to mean that the standard ISA or platform reset would
normally be handled directly by the arch, whereas if you have an
arch specific driver for a reset hardware that just happens to live
under arch/, then fsl_rstcr_restart / mpc85xx_cds_restart would be
valid use of reset notifier.

So this change seems reasonable to me. One small question:


> +static int mpc85xx_cds_restart_register(void)
> +{
> + static struct notifier_block restart_handler;
> +
> + restart_handler.notifier_call = mpc85xx_cds_restart;
> + restart_handler.priority = 192;

Should there be a header with #define's for these priorities?

Thanks,
Nick


linux-next: Tree for Aug 1

2016-07-31 Thread Stephen Rothwell
Hi all,

Please do not add material destined for v4.9 to your linux-next included
branches until after v4.8-rc1 has been released.

Changes since 20160729:

New Tree: befs

Non-merge commits (relative to Linus' tree): 4300
 3495 files changed, 145910 insertions(+), 65285 deletions(-)



I have created today's linux-next tree at
git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
(patches at http://www.kernel.org/pub/linux/kernel/next/ ).  If you
are tracking the linux-next tree using git, you should not use "git pull"
to do so as that will try to merge the new linux-next release with the
old one.  You should use "git fetch" and checkout or reset to the new
master.

You can see which trees have been included by looking in the Next/Trees
file in the source.  There are also quilt-import.log and merge.log
files in the Next directory.  Between each merge, the tree was built
with a ppc64_defconfig for powerpc and an allmodconfig (with
CONFIG_BUILD_DOCSRC=n) for x86_64, a multi_v7_defconfig for arm and a
native build of tools/perf. After the final fixups (if any), I do an
x86_64 modules_install followed by builds for x86_64 allnoconfig,
powerpc allnoconfig (32 and 64 bit), ppc44x_defconfig, allyesconfig
(this fails its final link) and pseries_le_defconfig and i386, sparc
and sparc64 defconfig.

Below is a summary of the state of the merge.

I am currently merging 241 trees (counting Linus' and 35 trees of patches
pending for Linus' tree).

Stats about the size of the tree over time can be seen at
http://neuling.org/linux-next-size.html .

Status of my local build tests will be at
http://kisskb.ellerman.id.au/linux-next .  If maintainers want to give
advice about cross compilers/configs that work, we are always open to add
more builds.

Thanks to Randy Dunlap for doing many randconfig builds.  And to Paul
Gortmaker for triage and bug fixes.

-- 
Cheers,
Stephen Rothwell

$ git checkout master
$ git reset --hard stable
Merging origin/master (c9b95e5961c0 Merge tag 'sound-4.8-rc1' of 
git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound)
Merging fixes/master (3fc9d690936f Merge branch 'for-4.8/drivers' of 
git://git.kernel.dk/linux-block)
Merging kbuild-current/rc-fixes (b36fad65d61f kbuild: Initialize exported 
variables)
Merging arc-current/for-curr (9bd54517ee86 arc: unwind: warn only once if 
DW2_UNWIND is disabled)
Merging arm-current/fixes (f6492164ecb1 ARM: 8577/1: Fix Cortex-A15 798181 
errata initialization)
Merging m68k-current/for-linus (6bd80f372371 m68k/defconfig: Update defconfigs 
for v4.7-rc2)
Merging metag-fixes/fixes (0164a711c97b metag: Fix ioremap_wc/ioremap_cached 
build errors)
Merging powerpc-fixes/fixes (bfa37087aa04 powerpc: Initialise pci_io_base as 
early as possible)
Merging powerpc-merge-mpe/fixes (bc0195aad0da Linux 4.2-rc2)
Merging sparc/master (797cee982eef Merge branch 'stable-4.8' of 
git://git.infradead.org/users/pcmoore/audit)
Merging net/master (bb9c0fa3aa29 net: dsa: bcm_sf2: Unwind errors in correct 
order)
Merging ipsec/master (6916fb3b10b3 xfrm: Ignore socket policies when rebuilding 
hash tables)
Merging netfilter/master (ea43f860d984 Merge branch 'ethoc-fixes')
Merging ipvs/master (ea43f860d984 Merge branch 'ethoc-fixes')
Merging wireless-drivers/master (034fdd4a17ff Merge ath-current from ath.git)
Merging mac80211/master (16a910a6722b cfg80211: handle failed skb allocation)
Merging sound-current/for-linus (0984d159c8ad sound: oss: Use 
kernel_read_file_from_path() for mod_firmware_load())
Merging pci-current/for-linus (ef0dab4aae14 PCI: Fix unaligned accesses in VC 
code)
Merging driver-core.current/driver-core-linus (523d939ef98f Linux 4.7)
Merging tty.current/tty-linus (0e06f5c0deee Merge branch 'akpm' (patches from 
Andrew))
Merging usb.current/usb-linus (e65805251f2d Merge branch 'irq-core-for-linus' 
of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip)
Merging usb-gadget-fixes/fixes (50c763f8c1ba usb: dwc3: Set the ClearPendIN bit 
on Clear Stall EP command)
Merging usb-serial-fixes/usb-linus (4c2e07c6a29e Linux 4.7-rc5)
Merging usb-chipidea-fixes/ci-for-usb-stable (ea1d39a31d3b usb: common: 
otg-fsm: add license to usb-otg-fsm)
Merging staging.current/staging-linus (0e06f5c0deee Merge branch 'akpm' 
(patches from Andrew))
Merging char-misc.current/char-misc-linus (0e06f5c0deee Merge branch 'akpm' 
(patches from Andrew))
Merging input-current/for-linus (080888286377 Merge branch 'next' into 
for-linus)
Merging crypto-current/master (8cf740ae85df crypto: marvell - Don't copy IV 
vectors from the _process op for ciphers)
Merging ide/master (797cee982eef Merge branch 'stable-4.8' of 
git://git.infradead.org/users/pcmoore/audit)
Merging rr-fixes/fixes (8244062ef1e5 modules: fix longstanding /proc/kallsyms 
vs module insertion race.)
Merging vfio-fixes/for-linus (ce7585f3c4d7 vfio/pci: Allow VPD short read)
Merging kselftest-fixes/fixes (f80eb4289491 selftests/exec: 

linux-next: Tree for Aug 1

2016-07-31 Thread Stephen Rothwell
Hi all,

Please do not add material destined for v4.9 to your linux-next included
branches until after v4.8-rc1 has been released.

Changes since 20160729:

New Tree: befs

Non-merge commits (relative to Linus' tree): 4300
 3495 files changed, 145910 insertions(+), 65285 deletions(-)



I have created today's linux-next tree at
git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
(patches at http://www.kernel.org/pub/linux/kernel/next/ ).  If you
are tracking the linux-next tree using git, you should not use "git pull"
to do so as that will try to merge the new linux-next release with the
old one.  You should use "git fetch" and checkout or reset to the new
master.

You can see which trees have been included by looking in the Next/Trees
file in the source.  There are also quilt-import.log and merge.log
files in the Next directory.  Between each merge, the tree was built
with a ppc64_defconfig for powerpc and an allmodconfig (with
CONFIG_BUILD_DOCSRC=n) for x86_64, a multi_v7_defconfig for arm and a
native build of tools/perf. After the final fixups (if any), I do an
x86_64 modules_install followed by builds for x86_64 allnoconfig,
powerpc allnoconfig (32 and 64 bit), ppc44x_defconfig, allyesconfig
(this fails its final link) and pseries_le_defconfig and i386, sparc
and sparc64 defconfig.

Below is a summary of the state of the merge.

I am currently merging 241 trees (counting Linus' and 35 trees of patches
pending for Linus' tree).

Stats about the size of the tree over time can be seen at
http://neuling.org/linux-next-size.html .

Status of my local build tests will be at
http://kisskb.ellerman.id.au/linux-next .  If maintainers want to give
advice about cross compilers/configs that work, we are always open to add
more builds.

Thanks to Randy Dunlap for doing many randconfig builds.  And to Paul
Gortmaker for triage and bug fixes.

-- 
Cheers,
Stephen Rothwell

$ git checkout master
$ git reset --hard stable
Merging origin/master (c9b95e5961c0 Merge tag 'sound-4.8-rc1' of 
git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound)
Merging fixes/master (3fc9d690936f Merge branch 'for-4.8/drivers' of 
git://git.kernel.dk/linux-block)
Merging kbuild-current/rc-fixes (b36fad65d61f kbuild: Initialize exported 
variables)
Merging arc-current/for-curr (9bd54517ee86 arc: unwind: warn only once if 
DW2_UNWIND is disabled)
Merging arm-current/fixes (f6492164ecb1 ARM: 8577/1: Fix Cortex-A15 798181 
errata initialization)
Merging m68k-current/for-linus (6bd80f372371 m68k/defconfig: Update defconfigs 
for v4.7-rc2)
Merging metag-fixes/fixes (0164a711c97b metag: Fix ioremap_wc/ioremap_cached 
build errors)
Merging powerpc-fixes/fixes (bfa37087aa04 powerpc: Initialise pci_io_base as 
early as possible)
Merging powerpc-merge-mpe/fixes (bc0195aad0da Linux 4.2-rc2)
Merging sparc/master (797cee982eef Merge branch 'stable-4.8' of 
git://git.infradead.org/users/pcmoore/audit)
Merging net/master (bb9c0fa3aa29 net: dsa: bcm_sf2: Unwind errors in correct 
order)
Merging ipsec/master (6916fb3b10b3 xfrm: Ignore socket policies when rebuilding 
hash tables)
Merging netfilter/master (ea43f860d984 Merge branch 'ethoc-fixes')
Merging ipvs/master (ea43f860d984 Merge branch 'ethoc-fixes')
Merging wireless-drivers/master (034fdd4a17ff Merge ath-current from ath.git)
Merging mac80211/master (16a910a6722b cfg80211: handle failed skb allocation)
Merging sound-current/for-linus (0984d159c8ad sound: oss: Use 
kernel_read_file_from_path() for mod_firmware_load())
Merging pci-current/for-linus (ef0dab4aae14 PCI: Fix unaligned accesses in VC 
code)
Merging driver-core.current/driver-core-linus (523d939ef98f Linux 4.7)
Merging tty.current/tty-linus (0e06f5c0deee Merge branch 'akpm' (patches from 
Andrew))
Merging usb.current/usb-linus (e65805251f2d Merge branch 'irq-core-for-linus' 
of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip)
Merging usb-gadget-fixes/fixes (50c763f8c1ba usb: dwc3: Set the ClearPendIN bit 
on Clear Stall EP command)
Merging usb-serial-fixes/usb-linus (4c2e07c6a29e Linux 4.7-rc5)
Merging usb-chipidea-fixes/ci-for-usb-stable (ea1d39a31d3b usb: common: 
otg-fsm: add license to usb-otg-fsm)
Merging staging.current/staging-linus (0e06f5c0deee Merge branch 'akpm' 
(patches from Andrew))
Merging char-misc.current/char-misc-linus (0e06f5c0deee Merge branch 'akpm' 
(patches from Andrew))
Merging input-current/for-linus (080888286377 Merge branch 'next' into 
for-linus)
Merging crypto-current/master (8cf740ae85df crypto: marvell - Don't copy IV 
vectors from the _process op for ciphers)
Merging ide/master (797cee982eef Merge branch 'stable-4.8' of 
git://git.infradead.org/users/pcmoore/audit)
Merging rr-fixes/fixes (8244062ef1e5 modules: fix longstanding /proc/kallsyms 
vs module insertion race.)
Merging vfio-fixes/for-linus (ce7585f3c4d7 vfio/pci: Allow VPD short read)
Merging kselftest-fixes/fixes (f80eb4289491 selftests/exec: 

[PATCH 5/6] clk: rockchip: rk3399: delete the CLK_IGNORE_UNUSED for aclk_pcie

2016-07-31 Thread Xing Zheng
From: Elaine Zhang 

allow aclk_pcie and aclk_perf_pcie disabled when unused.


Signed-off-by: Elaine Zhang 
Signed-off-by: Xing Zheng 
---

 drivers/clk/rockchip/clk-rk3399.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/rockchip/clk-rk3399.c 
b/drivers/clk/rockchip/clk-rk3399.c
index 74afec0..4a15ce5b 100644
--- a/drivers/clk/rockchip/clk-rk3399.c
+++ b/drivers/clk/rockchip/clk-rk3399.c
@@ -848,9 +848,9 @@ static struct rockchip_clk_branch rk3399_clk_branches[] 
__initdata = {
RK3399_CLKSEL_CON(14), 12, 2, DFLAGS,
RK3399_CLKGATE_CON(5), 4, GFLAGS),
 
-   GATE(ACLK_PERF_PCIE, "aclk_perf_pcie", "aclk_perihp", CLK_IGNORE_UNUSED,
+   GATE(ACLK_PERF_PCIE, "aclk_perf_pcie", "aclk_perihp", 0,
RK3399_CLKGATE_CON(20), 2, GFLAGS),
-   GATE(ACLK_PCIE, "aclk_pcie", "aclk_perihp", CLK_IGNORE_UNUSED,
+   GATE(ACLK_PCIE, "aclk_pcie", "aclk_perihp", 0,
RK3399_CLKGATE_CON(20), 10, GFLAGS),
GATE(0, "aclk_perihp_noc", "aclk_perihp", CLK_IGNORE_UNUSED,
RK3399_CLKGATE_CON(20), 12, GFLAGS),
-- 
1.7.9.5




[PATCH 5/6] clk: rockchip: rk3399: delete the CLK_IGNORE_UNUSED for aclk_pcie

2016-07-31 Thread Xing Zheng
From: Elaine Zhang 

allow aclk_pcie and aclk_perf_pcie disabled when unused.


Signed-off-by: Elaine Zhang 
Signed-off-by: Xing Zheng 
---

 drivers/clk/rockchip/clk-rk3399.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/rockchip/clk-rk3399.c 
b/drivers/clk/rockchip/clk-rk3399.c
index 74afec0..4a15ce5b 100644
--- a/drivers/clk/rockchip/clk-rk3399.c
+++ b/drivers/clk/rockchip/clk-rk3399.c
@@ -848,9 +848,9 @@ static struct rockchip_clk_branch rk3399_clk_branches[] 
__initdata = {
RK3399_CLKSEL_CON(14), 12, 2, DFLAGS,
RK3399_CLKGATE_CON(5), 4, GFLAGS),
 
-   GATE(ACLK_PERF_PCIE, "aclk_perf_pcie", "aclk_perihp", CLK_IGNORE_UNUSED,
+   GATE(ACLK_PERF_PCIE, "aclk_perf_pcie", "aclk_perihp", 0,
RK3399_CLKGATE_CON(20), 2, GFLAGS),
-   GATE(ACLK_PCIE, "aclk_pcie", "aclk_perihp", CLK_IGNORE_UNUSED,
+   GATE(ACLK_PCIE, "aclk_pcie", "aclk_perihp", 0,
RK3399_CLKGATE_CON(20), 10, GFLAGS),
GATE(0, "aclk_perihp_noc", "aclk_perihp", CLK_IGNORE_UNUSED,
RK3399_CLKGATE_CON(20), 12, GFLAGS),
-- 
1.7.9.5




[PATCH 3/6] clk: rockchip: rk3399: fix incorrect aclk_emmc source gate bits

2016-07-31 Thread Xing Zheng
Dues to incorrect diagram, we need to fix incorrect bits for
(c/g)pll_aclk_emmc_src:
cpll_aclk_emmc_src --> G6[13]
gpll_aclk_emmc_src --> G6[12]

Signed-off-by: Xing Zheng 
---

 drivers/clk/rockchip/clk-rk3399.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/rockchip/clk-rk3399.c 
b/drivers/clk/rockchip/clk-rk3399.c
index f55f967f..ad3860a 100644
--- a/drivers/clk/rockchip/clk-rk3399.c
+++ b/drivers/clk/rockchip/clk-rk3399.c
@@ -923,9 +923,9 @@ static struct rockchip_clk_branch rk3399_clk_branches[] 
__initdata = {
RK3399_CLKGATE_CON(6), 14, GFLAGS),
 
GATE(0, "cpll_aclk_emmc_src", "cpll", CLK_IGNORE_UNUSED,
-   RK3399_CLKGATE_CON(6), 12, GFLAGS),
-   GATE(0, "gpll_aclk_emmc_src", "gpll", CLK_IGNORE_UNUSED,
RK3399_CLKGATE_CON(6), 13, GFLAGS),
+   GATE(0, "gpll_aclk_emmc_src", "gpll", CLK_IGNORE_UNUSED,
+   RK3399_CLKGATE_CON(6), 12, GFLAGS),
COMPOSITE_NOGATE(ACLK_EMMC, "aclk_emmc", mux_aclk_emmc_p, 
CLK_IGNORE_UNUSED,
RK3399_CLKSEL_CON(21), 7, 1, MFLAGS, 0, 5, DFLAGS),
GATE(ACLK_EMMC_CORE, "aclk_emmccore", "aclk_emmc", CLK_IGNORE_UNUSED,
-- 
1.7.9.5




[PATCH 3/6] clk: rockchip: rk3399: fix incorrect aclk_emmc source gate bits

2016-07-31 Thread Xing Zheng
Dues to incorrect diagram, we need to fix incorrect bits for
(c/g)pll_aclk_emmc_src:
cpll_aclk_emmc_src --> G6[13]
gpll_aclk_emmc_src --> G6[12]

Signed-off-by: Xing Zheng 
---

 drivers/clk/rockchip/clk-rk3399.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/rockchip/clk-rk3399.c 
b/drivers/clk/rockchip/clk-rk3399.c
index f55f967f..ad3860a 100644
--- a/drivers/clk/rockchip/clk-rk3399.c
+++ b/drivers/clk/rockchip/clk-rk3399.c
@@ -923,9 +923,9 @@ static struct rockchip_clk_branch rk3399_clk_branches[] 
__initdata = {
RK3399_CLKGATE_CON(6), 14, GFLAGS),
 
GATE(0, "cpll_aclk_emmc_src", "cpll", CLK_IGNORE_UNUSED,
-   RK3399_CLKGATE_CON(6), 12, GFLAGS),
-   GATE(0, "gpll_aclk_emmc_src", "gpll", CLK_IGNORE_UNUSED,
RK3399_CLKGATE_CON(6), 13, GFLAGS),
+   GATE(0, "gpll_aclk_emmc_src", "gpll", CLK_IGNORE_UNUSED,
+   RK3399_CLKGATE_CON(6), 12, GFLAGS),
COMPOSITE_NOGATE(ACLK_EMMC, "aclk_emmc", mux_aclk_emmc_p, 
CLK_IGNORE_UNUSED,
RK3399_CLKSEL_CON(21), 7, 1, MFLAGS, 0, 5, DFLAGS),
GATE(ACLK_EMMC_CORE, "aclk_emmccore", "aclk_emmc", CLK_IGNORE_UNUSED,
-- 
1.7.9.5




[PATCH 0/6] fix and optimize some clock configuration for the RK3399 platfom

2016-07-31 Thread Xing Zheng

Hi:
  In the development work, we found that some of the previous
incorrect clock configuration on the RK3399 platform, we should
fix and optimize them.


Elaine Zhang (1):
  clk: rockchip: rk3399: delete the CLK_IGNORE_UNUSED for aclk_pcie

Xing Zheng (5):
  clk: rockchip: rk3399: export USBPHYx_480M_SRC clock IDs
  clk: rockchip: rk3399: export 480M_SRC clock id for usbphy0/usbphy1
  clk: rockchip: rk3399: fix incorrect aclk_emmc source gate bits
  clk: rockchip: rk3399: add 65MHz and 106.5MHz clocks for HDMI
  clk: rockchip: rk3399: Add support frac mode frequencies

 drivers/clk/rockchip/clk-rk3399.c  |   35 +---
 include/dt-bindings/clock/rk3399-cru.h |2 ++
 2 files changed, 30 insertions(+), 7 deletions(-)

-- 
1.7.9.5




[PATCH 0/6] fix and optimize some clock configuration for the RK3399 platfom

2016-07-31 Thread Xing Zheng

Hi:
  In the development work, we found that some of the previous
incorrect clock configuration on the RK3399 platform, we should
fix and optimize them.


Elaine Zhang (1):
  clk: rockchip: rk3399: delete the CLK_IGNORE_UNUSED for aclk_pcie

Xing Zheng (5):
  clk: rockchip: rk3399: export USBPHYx_480M_SRC clock IDs
  clk: rockchip: rk3399: export 480M_SRC clock id for usbphy0/usbphy1
  clk: rockchip: rk3399: fix incorrect aclk_emmc source gate bits
  clk: rockchip: rk3399: add 65MHz and 106.5MHz clocks for HDMI
  clk: rockchip: rk3399: Add support frac mode frequencies

 drivers/clk/rockchip/clk-rk3399.c  |   35 +---
 include/dt-bindings/clock/rk3399-cru.h |2 ++
 2 files changed, 30 insertions(+), 7 deletions(-)

-- 
1.7.9.5




[PATCH 1/6] clk: rockchip: rk3399: export USBPHYx_480M_SRC clock IDs

2016-07-31 Thread Xing Zheng
We export some clock IDs for the usb phy 480m source clocks.


Signed-off-by: Xing Zheng 
---

 include/dt-bindings/clock/rk3399-cru.h |2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/dt-bindings/clock/rk3399-cru.h 
b/include/dt-bindings/clock/rk3399-cru.h
index 50a44cf..c4d8311 100644
--- a/include/dt-bindings/clock/rk3399-cru.h
+++ b/include/dt-bindings/clock/rk3399-cru.h
@@ -131,6 +131,8 @@
 #define SCLK_DPHY_RX0_CFG  165
 #define SCLK_RMII_SRC  166
 #define SCLK_PCIEPHY_REF100M   167
+#define SCLK_USBPHY0_480M_SRC  168
+#define SCLK_USBPHY1_480M_SRC  169
 
 #define DCLK_VOP0  180
 #define DCLK_VOP1  181
-- 
1.7.9.5




[PATCH 2/6] clk: rockchip: rk3399: export 480M_SRC clock id for usbphy0/usbphy1

2016-07-31 Thread Xing Zheng
Export these source clocks for usbphy.


Signed-off-by: Xing Zheng 
---

 drivers/clk/rockchip/clk-rk3399.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/rockchip/clk-rk3399.c 
b/drivers/clk/rockchip/clk-rk3399.c
index 78e51cb..f55f967f 100644
--- a/drivers/clk/rockchip/clk-rk3399.c
+++ b/drivers/clk/rockchip/clk-rk3399.c
@@ -403,9 +403,9 @@ static struct rockchip_clk_branch rk3399_clk_branches[] 
__initdata = {
GATE(SCLK_USB2PHY1_REF, "clk_usb2phy1_ref", "xin24m", CLK_IGNORE_UNUSED,
RK3399_CLKGATE_CON(6), 6, GFLAGS),
 
-   GATE(0, "clk_usbphy0_480m_src", "clk_usbphy0_480m", CLK_IGNORE_UNUSED,
+   GATE(SCLK_USBPHY0_480M_SRC, "clk_usbphy0_480m_src", "clk_usbphy0_480m", 
CLK_IGNORE_UNUSED,
RK3399_CLKGATE_CON(13), 12, GFLAGS),
-   GATE(0, "clk_usbphy1_480m_src", "clk_usbphy1_480m", CLK_IGNORE_UNUSED,
+   GATE(SCLK_USBPHY1_480M_SRC, "clk_usbphy1_480m_src", "clk_usbphy1_480m", 
CLK_IGNORE_UNUSED,
RK3399_CLKGATE_CON(13), 12, GFLAGS),
MUX(0, "clk_usbphy_480m", mux_usbphy_480m_p, CLK_IGNORE_UNUSED,
RK3399_CLKSEL_CON(14), 6, 1, MFLAGS),
-- 
1.7.9.5




[PATCH 6/6] clk: rockchip: rk3399: Add support frac mode frequencies

2016-07-31 Thread Xing Zheng
We need to support various display resolutions for external
display devices like HDMI/DP, the frac mode can help us to
acquire almost any frequencies, and need higher VCOs to reduce
clock jitters.

Signed-off-by: Xing Zheng 
---

 drivers/clk/rockchip/clk-rk3399.c |   21 -
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/rockchip/clk-rk3399.c 
b/drivers/clk/rockchip/clk-rk3399.c
index 4a15ce5b..3daa164 100644
--- a/drivers/clk/rockchip/clk-rk3399.c
+++ b/drivers/clk/rockchip/clk-rk3399.c
@@ -109,6 +109,25 @@ static struct rockchip_pll_rate_table rk3399_pll_rates[] = 
{
{ /* sentinel */ },
 };
 
+static struct rockchip_pll_rate_table rk3399_pll_frates[] = {
+   /* _mhz, _refdiv, _fbdiv, _postdiv1, _postdiv2, _dsmpd, _frac */
+   RK3036_PLL_RATE( 59400, 1, 123, 5, 1, 0, 12582912),  /* vco = 
297000 */
+   RK3036_PLL_RATE( 593406593, 1, 123, 5, 1, 0, 10508804),  /* vco = 
2967032965 */
+   RK3036_PLL_RATE( 29700, 1, 123, 5, 2, 0, 12582912),  /* vco = 
297000 */
+   RK3036_PLL_RATE( 296703297, 1, 123, 5, 2, 0, 10508807),  /* vco = 
2967032970 */
+   RK3036_PLL_RATE( 14850, 1, 129, 7, 3, 0, 15728640),  /* vco = 
311850 */
+   RK3036_PLL_RATE( 148351648, 1, 123, 5, 4, 0, 10508800),  /* vco = 
2967032960 */
+   RK3036_PLL_RATE( 10650, 1, 124, 7, 4, 0,  4194304),  /* vco = 
298200 */
+   RK3036_PLL_RATE(  7425, 1, 129, 7, 6, 0, 15728640),  /* vco = 
311850 */
+   RK3036_PLL_RATE(  74175824, 1, 129, 7, 6, 0, 13550823),  /* vco = 
3115384608 */
+   RK3036_PLL_RATE(  6500, 1, 113, 7, 6, 0, 12582912),  /* vco = 
273000 */
+   RK3036_PLL_RATE(  59340659, 1, 121, 7, 7, 0,  2581098),  /* vco = 
2907692291 */
+   RK3036_PLL_RATE(  5400, 1, 110, 7, 7, 0,  4194304),  /* vco = 
264600 */
+   RK3036_PLL_RATE(  2700, 1,  55, 7, 7, 0,  2097152),  /* vco = 
132300 */
+   RK3036_PLL_RATE(  26973027, 1,  55, 7, 7, 0,  1173232),  /* vco = 
1321678323 */
+   { /* sentinel */ },
+};
+
 /* CRU parents */
 PNAME(mux_pll_p)   = { "xin24m", "xin32k" };
 
@@ -229,7 +248,7 @@ static struct rockchip_pll_clock rk3399_pll_clks[] 
__initdata = {
[npll] = PLL(pll_rk3399, PLL_NPLL, "npll",  mux_pll_p, 0, 
RK3399_PLL_CON(40),
 RK3399_PLL_CON(43), 8, 31, ROCKCHIP_PLL_SYNC_RATE, 
rk3399_pll_rates),
[vpll] = PLL(pll_rk3399, PLL_VPLL, "vpll",  mux_pll_p, 0, 
RK3399_PLL_CON(48),
-RK3399_PLL_CON(51), 8, 31, ROCKCHIP_PLL_SYNC_RATE, 
rk3399_pll_rates),
+RK3399_PLL_CON(51), 8, 31, ROCKCHIP_PLL_SYNC_RATE, 
rk3399_pll_frates),
 };
 
 static struct rockchip_pll_clock rk3399_pmu_pll_clks[] __initdata = {
-- 
1.7.9.5




[PATCH 1/6] clk: rockchip: rk3399: export USBPHYx_480M_SRC clock IDs

2016-07-31 Thread Xing Zheng
We export some clock IDs for the usb phy 480m source clocks.


Signed-off-by: Xing Zheng 
---

 include/dt-bindings/clock/rk3399-cru.h |2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/dt-bindings/clock/rk3399-cru.h 
b/include/dt-bindings/clock/rk3399-cru.h
index 50a44cf..c4d8311 100644
--- a/include/dt-bindings/clock/rk3399-cru.h
+++ b/include/dt-bindings/clock/rk3399-cru.h
@@ -131,6 +131,8 @@
 #define SCLK_DPHY_RX0_CFG  165
 #define SCLK_RMII_SRC  166
 #define SCLK_PCIEPHY_REF100M   167
+#define SCLK_USBPHY0_480M_SRC  168
+#define SCLK_USBPHY1_480M_SRC  169
 
 #define DCLK_VOP0  180
 #define DCLK_VOP1  181
-- 
1.7.9.5




[PATCH 2/6] clk: rockchip: rk3399: export 480M_SRC clock id for usbphy0/usbphy1

2016-07-31 Thread Xing Zheng
Export these source clocks for usbphy.


Signed-off-by: Xing Zheng 
---

 drivers/clk/rockchip/clk-rk3399.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/rockchip/clk-rk3399.c 
b/drivers/clk/rockchip/clk-rk3399.c
index 78e51cb..f55f967f 100644
--- a/drivers/clk/rockchip/clk-rk3399.c
+++ b/drivers/clk/rockchip/clk-rk3399.c
@@ -403,9 +403,9 @@ static struct rockchip_clk_branch rk3399_clk_branches[] 
__initdata = {
GATE(SCLK_USB2PHY1_REF, "clk_usb2phy1_ref", "xin24m", CLK_IGNORE_UNUSED,
RK3399_CLKGATE_CON(6), 6, GFLAGS),
 
-   GATE(0, "clk_usbphy0_480m_src", "clk_usbphy0_480m", CLK_IGNORE_UNUSED,
+   GATE(SCLK_USBPHY0_480M_SRC, "clk_usbphy0_480m_src", "clk_usbphy0_480m", 
CLK_IGNORE_UNUSED,
RK3399_CLKGATE_CON(13), 12, GFLAGS),
-   GATE(0, "clk_usbphy1_480m_src", "clk_usbphy1_480m", CLK_IGNORE_UNUSED,
+   GATE(SCLK_USBPHY1_480M_SRC, "clk_usbphy1_480m_src", "clk_usbphy1_480m", 
CLK_IGNORE_UNUSED,
RK3399_CLKGATE_CON(13), 12, GFLAGS),
MUX(0, "clk_usbphy_480m", mux_usbphy_480m_p, CLK_IGNORE_UNUSED,
RK3399_CLKSEL_CON(14), 6, 1, MFLAGS),
-- 
1.7.9.5




[PATCH 6/6] clk: rockchip: rk3399: Add support frac mode frequencies

2016-07-31 Thread Xing Zheng
We need to support various display resolutions for external
display devices like HDMI/DP, the frac mode can help us to
acquire almost any frequencies, and need higher VCOs to reduce
clock jitters.

Signed-off-by: Xing Zheng 
---

 drivers/clk/rockchip/clk-rk3399.c |   21 -
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/rockchip/clk-rk3399.c 
b/drivers/clk/rockchip/clk-rk3399.c
index 4a15ce5b..3daa164 100644
--- a/drivers/clk/rockchip/clk-rk3399.c
+++ b/drivers/clk/rockchip/clk-rk3399.c
@@ -109,6 +109,25 @@ static struct rockchip_pll_rate_table rk3399_pll_rates[] = 
{
{ /* sentinel */ },
 };
 
+static struct rockchip_pll_rate_table rk3399_pll_frates[] = {
+   /* _mhz, _refdiv, _fbdiv, _postdiv1, _postdiv2, _dsmpd, _frac */
+   RK3036_PLL_RATE( 59400, 1, 123, 5, 1, 0, 12582912),  /* vco = 
297000 */
+   RK3036_PLL_RATE( 593406593, 1, 123, 5, 1, 0, 10508804),  /* vco = 
2967032965 */
+   RK3036_PLL_RATE( 29700, 1, 123, 5, 2, 0, 12582912),  /* vco = 
297000 */
+   RK3036_PLL_RATE( 296703297, 1, 123, 5, 2, 0, 10508807),  /* vco = 
2967032970 */
+   RK3036_PLL_RATE( 14850, 1, 129, 7, 3, 0, 15728640),  /* vco = 
311850 */
+   RK3036_PLL_RATE( 148351648, 1, 123, 5, 4, 0, 10508800),  /* vco = 
2967032960 */
+   RK3036_PLL_RATE( 10650, 1, 124, 7, 4, 0,  4194304),  /* vco = 
298200 */
+   RK3036_PLL_RATE(  7425, 1, 129, 7, 6, 0, 15728640),  /* vco = 
311850 */
+   RK3036_PLL_RATE(  74175824, 1, 129, 7, 6, 0, 13550823),  /* vco = 
3115384608 */
+   RK3036_PLL_RATE(  6500, 1, 113, 7, 6, 0, 12582912),  /* vco = 
273000 */
+   RK3036_PLL_RATE(  59340659, 1, 121, 7, 7, 0,  2581098),  /* vco = 
2907692291 */
+   RK3036_PLL_RATE(  5400, 1, 110, 7, 7, 0,  4194304),  /* vco = 
264600 */
+   RK3036_PLL_RATE(  2700, 1,  55, 7, 7, 0,  2097152),  /* vco = 
132300 */
+   RK3036_PLL_RATE(  26973027, 1,  55, 7, 7, 0,  1173232),  /* vco = 
1321678323 */
+   { /* sentinel */ },
+};
+
 /* CRU parents */
 PNAME(mux_pll_p)   = { "xin24m", "xin32k" };
 
@@ -229,7 +248,7 @@ static struct rockchip_pll_clock rk3399_pll_clks[] 
__initdata = {
[npll] = PLL(pll_rk3399, PLL_NPLL, "npll",  mux_pll_p, 0, 
RK3399_PLL_CON(40),
 RK3399_PLL_CON(43), 8, 31, ROCKCHIP_PLL_SYNC_RATE, 
rk3399_pll_rates),
[vpll] = PLL(pll_rk3399, PLL_VPLL, "vpll",  mux_pll_p, 0, 
RK3399_PLL_CON(48),
-RK3399_PLL_CON(51), 8, 31, ROCKCHIP_PLL_SYNC_RATE, 
rk3399_pll_rates),
+RK3399_PLL_CON(51), 8, 31, ROCKCHIP_PLL_SYNC_RATE, 
rk3399_pll_frates),
 };
 
 static struct rockchip_pll_clock rk3399_pmu_pll_clks[] __initdata = {
-- 
1.7.9.5




[PATCH 4/6] clk: rockchip: rk3399: add 65MHz and 106.5MHz clocks for HDMI

2016-07-31 Thread Xing Zheng
We need to add more clocks for supporting more display resolution
for HDMI.

Signed-off-by: Xing Zheng 
---

 drivers/clk/rockchip/clk-rk3399.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/clk/rockchip/clk-rk3399.c 
b/drivers/clk/rockchip/clk-rk3399.c
index ad3860a..74afec0 100644
--- a/drivers/clk/rockchip/clk-rk3399.c
+++ b/drivers/clk/rockchip/clk-rk3399.c
@@ -100,8 +100,10 @@ static struct rockchip_pll_rate_table rk3399_pll_rates[] = 
{
RK3036_PLL_RATE( 29700, 1, 99, 4, 2, 1, 0),
RK3036_PLL_RATE( 21600, 1, 72, 4, 2, 1, 0),
RK3036_PLL_RATE( 14850, 1, 99, 4, 4, 1, 0),
+   RK3036_PLL_RATE( 10650, 1, 71, 4, 4, 1, 0),
RK3036_PLL_RATE(  9600, 1, 64, 4, 4, 1, 0),
RK3036_PLL_RATE(  7425, 2, 99, 4, 4, 1, 0),
+   RK3036_PLL_RATE(  6500, 1, 65, 6, 4, 1, 0),
RK3036_PLL_RATE(  5400, 1, 54, 6, 4, 1, 0),
RK3036_PLL_RATE(  2700, 1, 27, 6, 4, 1, 0),
{ /* sentinel */ },
-- 
1.7.9.5




[PATCH 4/6] clk: rockchip: rk3399: add 65MHz and 106.5MHz clocks for HDMI

2016-07-31 Thread Xing Zheng
We need to add more clocks for supporting more display resolution
for HDMI.

Signed-off-by: Xing Zheng 
---

 drivers/clk/rockchip/clk-rk3399.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/clk/rockchip/clk-rk3399.c 
b/drivers/clk/rockchip/clk-rk3399.c
index ad3860a..74afec0 100644
--- a/drivers/clk/rockchip/clk-rk3399.c
+++ b/drivers/clk/rockchip/clk-rk3399.c
@@ -100,8 +100,10 @@ static struct rockchip_pll_rate_table rk3399_pll_rates[] = 
{
RK3036_PLL_RATE( 29700, 1, 99, 4, 2, 1, 0),
RK3036_PLL_RATE( 21600, 1, 72, 4, 2, 1, 0),
RK3036_PLL_RATE( 14850, 1, 99, 4, 4, 1, 0),
+   RK3036_PLL_RATE( 10650, 1, 71, 4, 4, 1, 0),
RK3036_PLL_RATE(  9600, 1, 64, 4, 4, 1, 0),
RK3036_PLL_RATE(  7425, 2, 99, 4, 4, 1, 0),
+   RK3036_PLL_RATE(  6500, 1, 65, 6, 4, 1, 0),
RK3036_PLL_RATE(  5400, 1, 54, 6, 4, 1, 0),
RK3036_PLL_RATE(  2700, 1, 27, 6, 4, 1, 0),
{ /* sentinel */ },
-- 
1.7.9.5




Re: [PATCH 1/1] net: i10e: use matching format indentifiers

2016-07-31 Thread David Miller
From: Heinrich Schuchardt 
Date: Sun, 31 Jul 2016 11:39:28 +0200

> i is defined as int but output as %u several times.
> Change the definition to unsigned.
> 
> Signed-off-by: Heinrich Schuchardt 

I hate changes like this.

The canonical way to loop over a value is to use a signed integer,
named 'i', and go:

for (i = 0; i < X; i ++)

'i' can never be negative, therefore we know that this usage
is safe.

I'd rather you convert the "%u" to "%d".

I'm very disappointed in your patches, and it is clear you
are just finding the easiest and simplest way to shut up
compiler warnings you are seeing rather than analyzing the
code you are making changes to in order to determine what
the best and most appropriate fix might be.


Re: [PATCH v2 2/3] powerpc: Call chained reset handlers during reset

2016-07-31 Thread Nicholas Piggin
On Thu, 28 Jul 2016 16:07:17 -0700
Andrey Smirnov  wrote:

> Call out to all restart handlers that were added via
> register_restart_handler() API when restarting the machine.
> 
> Signed-off-by: Andrey Smirnov 
> ---
> 
> No changes compared to v1
> 
>  arch/powerpc/kernel/setup-common.c | 4 
>  1 file changed, 4 insertions(+)
> 
> diff --git a/arch/powerpc/kernel/setup-common.c
> b/arch/powerpc/kernel/setup-common.c index 5cd3283..205d073 100644
> --- a/arch/powerpc/kernel/setup-common.c
> +++ b/arch/powerpc/kernel/setup-common.c
> @@ -145,6 +145,10 @@ void machine_restart(char *cmd)
>   ppc_md.restart(cmd);
>  
>   smp_send_stop();
> +
> + do_kernel_restart(cmd);
> + mdelay(1000);
> +
>   machine_hang();
>  }
>  

Ah, I see why you don't move smp_send_stop(). 3 other architectures
call do_kernel_restart(). arm and arm64 call it with
local_irq_disabled(). arm and mips insert the 1s delay. All call it
after smp_send_stop(). I don't see the harm in the delay. Should we
call it with local interrupts disabled?



Re: [PATCH 1/1] net: i10e: use matching format indentifiers

2016-07-31 Thread David Miller
From: Heinrich Schuchardt 
Date: Sun, 31 Jul 2016 11:39:28 +0200

> i is defined as int but output as %u several times.
> Change the definition to unsigned.
> 
> Signed-off-by: Heinrich Schuchardt 

I hate changes like this.

The canonical way to loop over a value is to use a signed integer,
named 'i', and go:

for (i = 0; i < X; i ++)

'i' can never be negative, therefore we know that this usage
is safe.

I'd rather you convert the "%u" to "%d".

I'm very disappointed in your patches, and it is clear you
are just finding the easiest and simplest way to shut up
compiler warnings you are seeing rather than analyzing the
code you are making changes to in order to determine what
the best and most appropriate fix might be.


Re: [PATCH v2 2/3] powerpc: Call chained reset handlers during reset

2016-07-31 Thread Nicholas Piggin
On Thu, 28 Jul 2016 16:07:17 -0700
Andrey Smirnov  wrote:

> Call out to all restart handlers that were added via
> register_restart_handler() API when restarting the machine.
> 
> Signed-off-by: Andrey Smirnov 
> ---
> 
> No changes compared to v1
> 
>  arch/powerpc/kernel/setup-common.c | 4 
>  1 file changed, 4 insertions(+)
> 
> diff --git a/arch/powerpc/kernel/setup-common.c
> b/arch/powerpc/kernel/setup-common.c index 5cd3283..205d073 100644
> --- a/arch/powerpc/kernel/setup-common.c
> +++ b/arch/powerpc/kernel/setup-common.c
> @@ -145,6 +145,10 @@ void machine_restart(char *cmd)
>   ppc_md.restart(cmd);
>  
>   smp_send_stop();
> +
> + do_kernel_restart(cmd);
> + mdelay(1000);
> +
>   machine_hang();
>  }
>  

Ah, I see why you don't move smp_send_stop(). 3 other architectures
call do_kernel_restart(). arm and arm64 call it with
local_irq_disabled(). arm and mips insert the 1s delay. All call it
after smp_send_stop(). I don't see the harm in the delay. Should we
call it with local interrupts disabled?



Re: [PATCH 1/1] net: e1000: do not use uninitalized variable.

2016-07-31 Thread David Miller
From: Heinrich Schuchardt 
Date: Sun, 31 Jul 2016 11:30:58 +0200

> phy_data has to be set to zero to avoid undefined
> behavior.

In your opinion.

phy_data is only used in conditions where it has been initialized
in this function.

Therefore, please read the function carefully instead of just having
knee jerk reactions to whatever the compiler spits out.


Re: [PATCH 1/1] net: e1000: do not use uninitalized variable.

2016-07-31 Thread David Miller
From: Heinrich Schuchardt 
Date: Sun, 31 Jul 2016 11:30:58 +0200

> phy_data has to be set to zero to avoid undefined
> behavior.

In your opinion.

phy_data is only used in conditions where it has been initialized
in this function.

Therefore, please read the function carefully instead of just having
knee jerk reactions to whatever the compiler spits out.


[PATCH] silence warning in drivers/ata/libata-scsi.c when building W=1

2016-07-31 Thread Valdis Kletnieks
When building with W=1, we get these warnings:

drivers/ata/libata-scsi.c: In function 'ata_mselect_caching':
drivers/ata/libata-scsi.c:3637:28: warning: suggest parentheses around 
comparison in operand of '&' [-Wparentheses]
if (mpage[i + 2] & 0xfb != buf[i] & 0xfb) {
   ~^
drivers/ata/libata-scsi.c: In function 'ata_mselect_control':
drivers/ata/libata-scsi.c:3702:28: warning: suggest parentheses around 
comparison in operand of '&' [-Wparentheses]
if (mpage[i + 2] & 0xfb != buf[i] & 0xfb) {
   ~^

So give them the extra () and make things a bit clearer for both the
compiler and programmer...

Signed-off-by: Valdis Kletnieks 

diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index fa9d16fe295c..8ad4b237f342 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -3634,7 +3634,7 @@ static int ata_mselect_caching(struct ata_queued_cmd *qc,
/* Check the first byte */
if (i == 0) {
/* except the WCE bit */
-   if (mpage[i + 2] & 0xfb != buf[i] & 0xfb) {
+   if ((mpage[i + 2] & 0xfb) != (buf[i] & 0xfb)) {
*fp = i;
return -EINVAL;
} else {
@@ -3699,7 +3699,7 @@ static int ata_mselect_control(struct ata_queued_cmd *qc,
/* Check the first byte */
if (i == 0) {
/* except the D_SENSE bit */
-   if (mpage[i + 2] & 0xfb != buf[i] & 0xfb) {
+   if ((mpage[i + 2] & 0xfb) != (buf[i] & 0xfb)) {
*fp = i;
return -EINVAL;
} else {




[PATCH] silence warning in drivers/ata/libata-scsi.c when building W=1

2016-07-31 Thread Valdis Kletnieks
When building with W=1, we get these warnings:

drivers/ata/libata-scsi.c: In function 'ata_mselect_caching':
drivers/ata/libata-scsi.c:3637:28: warning: suggest parentheses around 
comparison in operand of '&' [-Wparentheses]
if (mpage[i + 2] & 0xfb != buf[i] & 0xfb) {
   ~^
drivers/ata/libata-scsi.c: In function 'ata_mselect_control':
drivers/ata/libata-scsi.c:3702:28: warning: suggest parentheses around 
comparison in operand of '&' [-Wparentheses]
if (mpage[i + 2] & 0xfb != buf[i] & 0xfb) {
   ~^

So give them the extra () and make things a bit clearer for both the
compiler and programmer...

Signed-off-by: Valdis Kletnieks 

diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index fa9d16fe295c..8ad4b237f342 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -3634,7 +3634,7 @@ static int ata_mselect_caching(struct ata_queued_cmd *qc,
/* Check the first byte */
if (i == 0) {
/* except the WCE bit */
-   if (mpage[i + 2] & 0xfb != buf[i] & 0xfb) {
+   if ((mpage[i + 2] & 0xfb) != (buf[i] & 0xfb)) {
*fp = i;
return -EINVAL;
} else {
@@ -3699,7 +3699,7 @@ static int ata_mselect_control(struct ata_queued_cmd *qc,
/* Check the first byte */
if (i == 0) {
/* except the D_SENSE bit */
-   if (mpage[i + 2] & 0xfb != buf[i] & 0xfb) {
+   if ((mpage[i + 2] & 0xfb) != (buf[i] & 0xfb)) {
*fp = i;
return -EINVAL;
} else {




Re: [PATCH v3 00/15] net: thunderx: Add support for 81xx and 83xx

2016-07-31 Thread Sunil Kovvuri
Understood but unfortunately I don't see these patches in patchwork.
http://patchwork.ozlabs.org/project/netdev/list/?submitter==*=thunderx=both=
http://patchwork.ozlabs.org/project/netdev/list/?submitter=62159=*==both=

Thanks,
Sunil.

On Mon, Aug 1, 2016 at 12:24 AM, David Miller  wrote:
> From: Sunil Kovvuri 
> Date: Mon, 1 Aug 2016 00:44:08 +0800
>
>> A gentle reminder.
>>
>> David,
>> Let me know if I need to resubmit the patches on top of latest net-next.
>> Will do that.
>
> Your patches are marked appropriately in patchwork and tell you everything
> you need to know about the state of your patch series.
>
> You never need to ask me questions like this, ever.


Re: [PATCH v3 00/15] net: thunderx: Add support for 81xx and 83xx

2016-07-31 Thread Sunil Kovvuri
Understood but unfortunately I don't see these patches in patchwork.
http://patchwork.ozlabs.org/project/netdev/list/?submitter==*=thunderx=both=
http://patchwork.ozlabs.org/project/netdev/list/?submitter=62159=*==both=

Thanks,
Sunil.

On Mon, Aug 1, 2016 at 12:24 AM, David Miller  wrote:
> From: Sunil Kovvuri 
> Date: Mon, 1 Aug 2016 00:44:08 +0800
>
>> A gentle reminder.
>>
>> David,
>> Let me know if I need to resubmit the patches on top of latest net-next.
>> Will do that.
>
> Your patches are marked appropriately in patchwork and tell you everything
> you need to know about the state of your patch series.
>
> You never need to ask me questions like this, ever.


Re: [PATCH v2 1/3] powerpc: Factor out common code in setup-common.c

2016-07-31 Thread Nicholas Piggin
On Thu, 28 Jul 2016 16:07:16 -0700
Andrey Smirnov  wrote:

> Factor out a small bit of common code in machine_restart(),
> machine_power_off() and machine_halt().
> 
> Signed-off-by: Andrey Smirnov 
> ---
> 
> No changes compared to v1.
> 
>  arch/powerpc/kernel/setup-common.c | 23 ++-
>  1 file changed, 14 insertions(+), 9 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/setup-common.c
> b/arch/powerpc/kernel/setup-common.c index 714b4ba..5cd3283 100644
> --- a/arch/powerpc/kernel/setup-common.c
> +++ b/arch/powerpc/kernel/setup-common.c
> @@ -130,15 +130,22 @@ void machine_shutdown(void)
>   ppc_md.machine_shutdown();
>  }
>  
> +static void machine_hang(void)
> +{
> + pr_emerg("System Halted, OK to turn off power\n");
> + local_irq_disable();
> + while (1)
> + ;
> +}

What's the intended semantics of this function? A default power
off handler when the platform supplies none? Would ppc_power_off()
be a good name? Should the smp_send_stop() call be moved here?

It seems like a reasonable cleanup though.

Thanks,
Nick


Re: [PATCH v2 1/3] powerpc: Factor out common code in setup-common.c

2016-07-31 Thread Nicholas Piggin
On Thu, 28 Jul 2016 16:07:16 -0700
Andrey Smirnov  wrote:

> Factor out a small bit of common code in machine_restart(),
> machine_power_off() and machine_halt().
> 
> Signed-off-by: Andrey Smirnov 
> ---
> 
> No changes compared to v1.
> 
>  arch/powerpc/kernel/setup-common.c | 23 ++-
>  1 file changed, 14 insertions(+), 9 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/setup-common.c
> b/arch/powerpc/kernel/setup-common.c index 714b4ba..5cd3283 100644
> --- a/arch/powerpc/kernel/setup-common.c
> +++ b/arch/powerpc/kernel/setup-common.c
> @@ -130,15 +130,22 @@ void machine_shutdown(void)
>   ppc_md.machine_shutdown();
>  }
>  
> +static void machine_hang(void)
> +{
> + pr_emerg("System Halted, OK to turn off power\n");
> + local_irq_disable();
> + while (1)
> + ;
> +}

What's the intended semantics of this function? A default power
off handler when the platform supplies none? Would ppc_power_off()
be a good name? Should the smp_send_stop() call be moved here?

It seems like a reasonable cleanup though.

Thanks,
Nick


Re: [PATCH] drm/analogix_dp: Ensure the panel is properly prepared/unprepared

2016-07-31 Thread Yakir Yang

Sean,

On 07/30/2016 03:16 AM, Sean Paul wrote:

Instead of just preparing the panel on bind, actually prepare/unprepare
during modeset/disable. The panel must be prepared in order to read hpd
status, so we need to refcount the prepares in order to ensure we don't
accidentally turn the panel off at the wrong time.

Signed-off-by: Sean Paul 
---


Hi Yakir,
This is what I was talking about upthread. I've tested it and it seems to be 
working.

What do you think?


Thanks for your patch, and it works. But I have introduced two 
questions, and I haven't found a way to fixed them.



Sean



drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 48 +-
  1 file changed, 37 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c 
b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
index 32715da..7b764a4 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
+++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
@@ -960,11 +960,27 @@ enum drm_connector_status
  analogix_dp_detect(struct drm_connector *connector, bool force)
  {
struct analogix_dp_device *dp = to_dp(connector);
+   enum drm_connector_status status = connector_status_disconnected;
+   int ret;
  
-	if (analogix_dp_detect_hpd(dp))

-   return connector_status_disconnected;
+   if (dp->plat_data->panel && dp->dpms_mode != DRM_MODE_DPMS_ON) {
+   ret = drm_panel_prepare(dp->plat_data->panel);
+   if (ret) {
+   DRM_ERROR("failed to setup panel (%d)\n", ret);
+   return connector_status_disconnected;
+   }
+   }
+
+   if (!analogix_dp_detect_hpd(dp))
+   status = connector_status_connected;
+
+   if (dp->plat_data->panel && dp->dpms_mode != DRM_MODE_DPMS_ON) {
+   ret = drm_panel_unprepare(dp->plat_data->panel);
+   if (ret)
+   DRM_ERROR("failed to setup the panel ret = %d\n", ret);
+   }
  
-	return connector_status_connected;

+   return status;


1. Panel would flicker at system boot time. Your patch would flash the 
panel power in connector->detect() function when dp->dpms_mode isn't 
DRM_MODE_DPMS_OFF. So when userspace keep detect the connector status in 
boot time, we could see panel would flicker (light up for a while, and 
turn off again, and keep loop for several time). I have copied some 
kernel logs:



[   11.065267] YKK - analogix_dp_detect:1052
[   11.729596] YKK - analogix_dp_get_modes:1016
[   11.737608] rockchip-dp ff97.edp: 
analogix_dp_read_bytes_from_dpcd: Aux Transaction fail!
[   11.749229] rockchip-dp ff97.edp: 
analogix_dp_read_bytes_from_dpcd: Aux Transaction fail!
[   11.760799] rockchip-dp ff97.edp: 
analogix_dp_read_bytes_from_dpcd: Aux Transaction fail!

[   13.315962] YKK - analogix_dp_detect:1052
[   13.984702] YKK - analogix_dp_get_modes:1016
[   13.992977] rockchip-dp ff97.edp: 
analogix_dp_read_bytes_from_dpcd: Aux Transaction fail!
[   14.004414] rockchip-dp ff97.edp: 
analogix_dp_read_bytes_from_dpcd: Aux Transaction fail!
[   14.015842] rockchip-dp ff97.edp: 
analogix_dp_read_bytes_from_dpcd: Aux Transaction fail!

[   14.183109] YKK - analogix_dp_bridge_pre_enable:1147
[   14.306301] rockchip-dp ff97.edp: Link Training Clock Recovery 
success

[   14.319130] rockchip-dp ff97.edp: Link Training success!
[   14.326388] rockchip-dp ff97.edp: wait SYS_CTL_2.
[   14.437247] rockchip-dp ff97.edp: Timeout of video streamclk ok
[   14.443585] rockchip-dp ff97.edp: unable to config video



  }
  
  static void analogix_dp_connector_destroy(struct drm_connector *connector)

@@ -1035,6 +1051,18 @@ static int analogix_dp_bridge_attach(struct drm_bridge 
*bridge)
return 0;
  }
  
+static void analogix_dp_bridge_pre_enable(struct drm_bridge *bridge)

+{
+   struct analogix_dp_device *dp = bridge->driver_private;
+   int ret;
+
+   if (dp->plat_data->panel) {
+   ret = drm_panel_prepare(dp->plat_data->panel);
+   if (ret)
+   DRM_ERROR("failed to setup the panel ret = %d\n", ret);
+   }


2. Driver would failed to read EDID in some case. Panel would only be 
powered up in bridge->pre_enable() function which later than 
connector->get_modes() function, and this would caused DPCD transfer 
failed in analogix_dp_handle_edid(). This seem won't caused too big 
issue, cause userspace would read EDID again after bridge/encoder is 
enabled. But it's better to avoid this potential bug.



[   11.065267] YKK - analogix_dp_detect:1052
[   11.729596] YKK - analogix_dp_get_modes:1016
[   11.737608] rockchip-dp ff97.edp: 
analogix_dp_read_bytes_from_dpcd: Aux Transaction fail!
[   11.749229] rockchip-dp ff97.edp: 
analogix_dp_read_bytes_from_dpcd: Aux Transaction fail!
[   11.760799] 

Re: [PATCH] drm/analogix_dp: Ensure the panel is properly prepared/unprepared

2016-07-31 Thread Yakir Yang

Sean,

On 07/30/2016 03:16 AM, Sean Paul wrote:

Instead of just preparing the panel on bind, actually prepare/unprepare
during modeset/disable. The panel must be prepared in order to read hpd
status, so we need to refcount the prepares in order to ensure we don't
accidentally turn the panel off at the wrong time.

Signed-off-by: Sean Paul 
---


Hi Yakir,
This is what I was talking about upthread. I've tested it and it seems to be 
working.

What do you think?


Thanks for your patch, and it works. But I have introduced two 
questions, and I haven't found a way to fixed them.



Sean



drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 48 +-
  1 file changed, 37 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c 
b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
index 32715da..7b764a4 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
+++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
@@ -960,11 +960,27 @@ enum drm_connector_status
  analogix_dp_detect(struct drm_connector *connector, bool force)
  {
struct analogix_dp_device *dp = to_dp(connector);
+   enum drm_connector_status status = connector_status_disconnected;
+   int ret;
  
-	if (analogix_dp_detect_hpd(dp))

-   return connector_status_disconnected;
+   if (dp->plat_data->panel && dp->dpms_mode != DRM_MODE_DPMS_ON) {
+   ret = drm_panel_prepare(dp->plat_data->panel);
+   if (ret) {
+   DRM_ERROR("failed to setup panel (%d)\n", ret);
+   return connector_status_disconnected;
+   }
+   }
+
+   if (!analogix_dp_detect_hpd(dp))
+   status = connector_status_connected;
+
+   if (dp->plat_data->panel && dp->dpms_mode != DRM_MODE_DPMS_ON) {
+   ret = drm_panel_unprepare(dp->plat_data->panel);
+   if (ret)
+   DRM_ERROR("failed to setup the panel ret = %d\n", ret);
+   }
  
-	return connector_status_connected;

+   return status;


1. Panel would flicker at system boot time. Your patch would flash the 
panel power in connector->detect() function when dp->dpms_mode isn't 
DRM_MODE_DPMS_OFF. So when userspace keep detect the connector status in 
boot time, we could see panel would flicker (light up for a while, and 
turn off again, and keep loop for several time). I have copied some 
kernel logs:



[   11.065267] YKK - analogix_dp_detect:1052
[   11.729596] YKK - analogix_dp_get_modes:1016
[   11.737608] rockchip-dp ff97.edp: 
analogix_dp_read_bytes_from_dpcd: Aux Transaction fail!
[   11.749229] rockchip-dp ff97.edp: 
analogix_dp_read_bytes_from_dpcd: Aux Transaction fail!
[   11.760799] rockchip-dp ff97.edp: 
analogix_dp_read_bytes_from_dpcd: Aux Transaction fail!

[   13.315962] YKK - analogix_dp_detect:1052
[   13.984702] YKK - analogix_dp_get_modes:1016
[   13.992977] rockchip-dp ff97.edp: 
analogix_dp_read_bytes_from_dpcd: Aux Transaction fail!
[   14.004414] rockchip-dp ff97.edp: 
analogix_dp_read_bytes_from_dpcd: Aux Transaction fail!
[   14.015842] rockchip-dp ff97.edp: 
analogix_dp_read_bytes_from_dpcd: Aux Transaction fail!

[   14.183109] YKK - analogix_dp_bridge_pre_enable:1147
[   14.306301] rockchip-dp ff97.edp: Link Training Clock Recovery 
success

[   14.319130] rockchip-dp ff97.edp: Link Training success!
[   14.326388] rockchip-dp ff97.edp: wait SYS_CTL_2.
[   14.437247] rockchip-dp ff97.edp: Timeout of video streamclk ok
[   14.443585] rockchip-dp ff97.edp: unable to config video



  }
  
  static void analogix_dp_connector_destroy(struct drm_connector *connector)

@@ -1035,6 +1051,18 @@ static int analogix_dp_bridge_attach(struct drm_bridge 
*bridge)
return 0;
  }
  
+static void analogix_dp_bridge_pre_enable(struct drm_bridge *bridge)

+{
+   struct analogix_dp_device *dp = bridge->driver_private;
+   int ret;
+
+   if (dp->plat_data->panel) {
+   ret = drm_panel_prepare(dp->plat_data->panel);
+   if (ret)
+   DRM_ERROR("failed to setup the panel ret = %d\n", ret);
+   }


2. Driver would failed to read EDID in some case. Panel would only be 
powered up in bridge->pre_enable() function which later than 
connector->get_modes() function, and this would caused DPCD transfer 
failed in analogix_dp_handle_edid(). This seem won't caused too big 
issue, cause userspace would read EDID again after bridge/encoder is 
enabled. But it's better to avoid this potential bug.



[   11.065267] YKK - analogix_dp_detect:1052
[   11.729596] YKK - analogix_dp_get_modes:1016
[   11.737608] rockchip-dp ff97.edp: 
analogix_dp_read_bytes_from_dpcd: Aux Transaction fail!
[   11.749229] rockchip-dp ff97.edp: 
analogix_dp_read_bytes_from_dpcd: Aux Transaction fail!
[   11.760799] rockchip-dp ff97.edp: 

Re: [PATCH v3 00/15] net: thunderx: Add support for 81xx and 83xx

2016-07-31 Thread David Miller
From: Sunil Kovvuri 
Date: Mon, 1 Aug 2016 08:59:16 +0530

> Understood but unfortunately I don't see these patches in patchwork.
> http://patchwork.ozlabs.org/project/netdev/list/?submitter==*=thunderx=both=
> http://patchwork.ozlabs.org/project/netdev/list/?submitter=62159=*==both=

Then you'll need to resubmit them.

But net-next is closed at this time, so new feature submissions are
not appropriate.  You need to wait until the net-next tree opens
again.


Re: [PATCH v3 00/15] net: thunderx: Add support for 81xx and 83xx

2016-07-31 Thread David Miller
From: Sunil Kovvuri 
Date: Mon, 1 Aug 2016 08:59:16 +0530

> Understood but unfortunately I don't see these patches in patchwork.
> http://patchwork.ozlabs.org/project/netdev/list/?submitter==*=thunderx=both=
> http://patchwork.ozlabs.org/project/netdev/list/?submitter=62159=*==both=

Then you'll need to resubmit them.

But net-next is closed at this time, so new feature submissions are
not appropriate.  You need to wait until the net-next tree opens
again.


[PATCH] clocksource: mips-gic-timer: make gic_clocksource_of_init return int

2016-07-31 Thread Paul Gortmaker
In commit d8152bf85d2c057fc39c3e20a4d623f524d9f09c:
  ("clocksource/drivers/mips-gic-timer: Convert init function to return error")

several return values were added to a void function resulting in:

 clocksource/mips-gic-timer.c: In function 'gic_clocksource_of_init':
 clocksource/mips-gic-timer.c:175:3: warning: 'return' with a value, in 
function returning void [enabled by default]
 clocksource/mips-gic-timer.c:183:4: warning: 'return' with a value, in 
function returning void [enabled by default]
 clocksource/mips-gic-timer.c:190:3: warning: 'return' with a value, in 
function returning void [enabled by default]
 clocksource/mips-gic-timer.c:195:3: warning: 'return' with a value, in 
function returning void [enabled by default]
 clocksource/mips-gic-timer.c:200:3: warning: 'return' with a value, in 
function returning void [enabled by default]
 clocksource/mips-gic-timer.c:211:2: warning: 'return' with a value, in 
function returning void [enabled by default]
 clocksource/mips-gic-timer.c: At top level:
 clocksource/mips-gic-timer.c:213:1: warning: comparison of distinct pointer 
types lacks a cast [enabled by default]
 clocksource/mips-gic-timer.c: In function 'gic_clocksource_of_init':
 clocksource/mips-gic-timer.c:183:18: warning: ignoring return value of 
'PTR_ERR', declared with attribute warn_unused_result [-Wunused-result]

Given that the addition of the return values was intentional, it seems
that the conversion of the containing function from void to int was
simply overlooked.

Cc: Daniel Lezcano 
Cc: linux-m...@linux-mips.org
Signed-off-by: Paul Gortmaker 
---
 drivers/clocksource/mips-gic-timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clocksource/mips-gic-timer.c 
b/drivers/clocksource/mips-gic-timer.c
index d91e8725917c..b4b3ab5a11ad 100644
--- a/drivers/clocksource/mips-gic-timer.c
+++ b/drivers/clocksource/mips-gic-timer.c
@@ -164,7 +164,7 @@ void __init gic_clocksource_init(unsigned int frequency)
gic_start_count();
 }
 
-static void __init gic_clocksource_of_init(struct device_node *node)
+static int __init gic_clocksource_of_init(struct device_node *node)
 {
struct clk *clk;
int ret;
-- 
2.8.4



[PATCH] clocksource: mips-gic-timer: make gic_clocksource_of_init return int

2016-07-31 Thread Paul Gortmaker
In commit d8152bf85d2c057fc39c3e20a4d623f524d9f09c:
  ("clocksource/drivers/mips-gic-timer: Convert init function to return error")

several return values were added to a void function resulting in:

 clocksource/mips-gic-timer.c: In function 'gic_clocksource_of_init':
 clocksource/mips-gic-timer.c:175:3: warning: 'return' with a value, in 
function returning void [enabled by default]
 clocksource/mips-gic-timer.c:183:4: warning: 'return' with a value, in 
function returning void [enabled by default]
 clocksource/mips-gic-timer.c:190:3: warning: 'return' with a value, in 
function returning void [enabled by default]
 clocksource/mips-gic-timer.c:195:3: warning: 'return' with a value, in 
function returning void [enabled by default]
 clocksource/mips-gic-timer.c:200:3: warning: 'return' with a value, in 
function returning void [enabled by default]
 clocksource/mips-gic-timer.c:211:2: warning: 'return' with a value, in 
function returning void [enabled by default]
 clocksource/mips-gic-timer.c: At top level:
 clocksource/mips-gic-timer.c:213:1: warning: comparison of distinct pointer 
types lacks a cast [enabled by default]
 clocksource/mips-gic-timer.c: In function 'gic_clocksource_of_init':
 clocksource/mips-gic-timer.c:183:18: warning: ignoring return value of 
'PTR_ERR', declared with attribute warn_unused_result [-Wunused-result]

Given that the addition of the return values was intentional, it seems
that the conversion of the containing function from void to int was
simply overlooked.

Cc: Daniel Lezcano 
Cc: linux-m...@linux-mips.org
Signed-off-by: Paul Gortmaker 
---
 drivers/clocksource/mips-gic-timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clocksource/mips-gic-timer.c 
b/drivers/clocksource/mips-gic-timer.c
index d91e8725917c..b4b3ab5a11ad 100644
--- a/drivers/clocksource/mips-gic-timer.c
+++ b/drivers/clocksource/mips-gic-timer.c
@@ -164,7 +164,7 @@ void __init gic_clocksource_init(unsigned int frequency)
gic_start_count();
 }
 
-static void __init gic_clocksource_of_init(struct device_node *node)
+static int __init gic_clocksource_of_init(struct device_node *node)
 {
struct clk *clk;
int ret;
-- 
2.8.4



Re: [PATCH] silence warnings when building kernel/bpf/core.c with W=1

2016-07-31 Thread David Miller
From: Valdis Kletnieks 
Date: Sun, 31 Jul 2016 23:27:33 -0400

> Building with W=1 generates some 350 lines of warnings of the form:
> 
> kernel/bpf/core.c: In function '__bpf_prog_run':
> kernel/bpf/core.c:476:33: warning: initialized field overwritten 
> [-Woverride-init]
>[BPF_ALU | BPF_ADD | BPF_X] = &_ADD_X,
>  ^~
> kernel/bpf/core.c:476:33: note: (near initialization for 'jumptable[12]')
> 
> Since they come from the way we intentionally build the table, silence
> that one specific warning.
> 
> Signed-off-by: Valdis Kletnieks 

Patch submission must use a proper subsystem prefix in their Subject lines,
as this ends up in the kernel commit shortlog.

The appropriate subsystem prefix for this patch is "bpf: "


Re: [PATCH] silence warnings when building kernel/bpf/core.c with W=1

2016-07-31 Thread David Miller
From: Valdis Kletnieks 
Date: Sun, 31 Jul 2016 23:27:33 -0400

> Building with W=1 generates some 350 lines of warnings of the form:
> 
> kernel/bpf/core.c: In function '__bpf_prog_run':
> kernel/bpf/core.c:476:33: warning: initialized field overwritten 
> [-Woverride-init]
>[BPF_ALU | BPF_ADD | BPF_X] = &_ADD_X,
>  ^~
> kernel/bpf/core.c:476:33: note: (near initialization for 'jumptable[12]')
> 
> Since they come from the way we intentionally build the table, silence
> that one specific warning.
> 
> Signed-off-by: Valdis Kletnieks 

Patch submission must use a proper subsystem prefix in their Subject lines,
as this ends up in the kernel commit shortlog.

The appropriate subsystem prefix for this patch is "bpf: "


Re: [PATCH net v2 0/3] r8169:fix 3 runtime pm related issues.

2016-07-31 Thread David Miller
From: Chunhao Lin 
Date: Fri, 29 Jul 2016 16:37:53 +0800

> v2:
> use "struct device *d = >pci_dev->dev" instead of "struct pci_dev *pdev = 
> tp->pci_dev"
> 
> v1:
> This series of patches fix 3 runtime pm related issues that are listed below.

Series applied, thanks.


Re: [PATCH net v2 0/3] r8169:fix 3 runtime pm related issues.

2016-07-31 Thread David Miller
From: Chunhao Lin 
Date: Fri, 29 Jul 2016 16:37:53 +0800

> v2:
> use "struct device *d = >pci_dev->dev" instead of "struct pci_dev *pdev = 
> tp->pci_dev"
> 
> v1:
> This series of patches fix 3 runtime pm related issues that are listed below.

Series applied, thanks.


Re: [PATCH 1/1] net: qlcnic: avoid superfluous assignement

2016-07-31 Thread David Miller
From: zhuyj 
Date: Mon, 1 Aug 2016 10:57:20 +0800

> Sorry.
> An inline function will be inserted into the calling function. Why
> "Assigning NULL to parmeter dcb has no effect outside of the
> inlined function." ?

It doesn't do anything to "dcb" in the calling function, that's not
how inlining works.

The inlined function behaves exactly as if it were called as a
non-inline function from the perspective of side effects visible to
the program.


Re: [PATCH 1/1] net: qlcnic: avoid superfluous assignement

2016-07-31 Thread David Miller
From: zhuyj 
Date: Mon, 1 Aug 2016 10:57:20 +0800

> Sorry.
> An inline function will be inserted into the calling function. Why
> "Assigning NULL to parmeter dcb has no effect outside of the
> inlined function." ?

It doesn't do anything to "dcb" in the calling function, that's not
how inlining works.

The inlined function behaves exactly as if it were called as a
non-inline function from the perspective of side effects visible to
the program.


Re: [PATCH] drm/analogix_dp: Ensure the panel is properly prepared/unprepared

2016-07-31 Thread Yakir Yang

Sean,

On 07/30/2016 03:16 AM, Sean Paul wrote:

Instead of just preparing the panel on bind, actually prepare/unprepare
during modeset/disable. The panel must be prepared in order to read hpd
status, so we need to refcount the prepares in order to ensure we don't
accidentally turn the panel off at the wrong time.

Signed-off-by: Sean Paul 
---


Hi Yakir,
This is what I was talking about upthread. I've tested it and it seems to be 
working.

What do you think?


Thanks for your patch, and it works. But I have introduced two 
questions, and I haven't found a way to fixed them.



Sean



drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 48 +-
  1 file changed, 37 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c 
b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
index 32715da..7b764a4 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
+++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
@@ -960,11 +960,27 @@ enum drm_connector_status
  analogix_dp_detect(struct drm_connector *connector, bool force)
  {
struct analogix_dp_device *dp = to_dp(connector);
+   enum drm_connector_status status = connector_status_disconnected;
+   int ret;
  
-	if (analogix_dp_detect_hpd(dp))

-   return connector_status_disconnected;
+   if (dp->plat_data->panel && dp->dpms_mode != DRM_MODE_DPMS_ON) {
+   ret = drm_panel_prepare(dp->plat_data->panel);
+   if (ret) {
+   DRM_ERROR("failed to setup panel (%d)\n", ret);
+   return connector_status_disconnected;
+   }
+   }
+
+   if (!analogix_dp_detect_hpd(dp))
+   status = connector_status_connected;
+
+   if (dp->plat_data->panel && dp->dpms_mode != DRM_MODE_DPMS_ON) {
+   ret = drm_panel_unprepare(dp->plat_data->panel);
+   if (ret)
+   DRM_ERROR("failed to setup the panel ret = %d\n", ret);
+   }
  
-	return connector_status_connected;

+   return status;


1. Panel would flicker at system boot time. Your patch would flash the 
panel power in connector->detect() function when dp->dpms_mode isn't 
DRM_MODE_DPMS_OFF. So when userspace keep detect the connector status in 
boot time, we could see panel would flicker (light up for a while, and 
turn off again, and keep loop for several time). I have copied some 
kernel logs:



[   11.065267] YKK - analogix_dp_detect:1052
[   11.729596] YKK - analogix_dp_get_modes:1016
[   11.737608] rockchip-dp ff97.edp: 
analogix_dp_read_bytes_from_dpcd: Aux Transaction fail!
[   11.749229] rockchip-dp ff97.edp: 
analogix_dp_read_bytes_from_dpcd: Aux Transaction fail!
[   11.760799] rockchip-dp ff97.edp: 
analogix_dp_read_bytes_from_dpcd: Aux Transaction fail!

[   13.315962] YKK - analogix_dp_detect:1052
[   13.984702] YKK - analogix_dp_get_modes:1016
[   13.992977] rockchip-dp ff97.edp: 
analogix_dp_read_bytes_from_dpcd: Aux Transaction fail!
[   14.004414] rockchip-dp ff97.edp: 
analogix_dp_read_bytes_from_dpcd: Aux Transaction fail!
[   14.015842] rockchip-dp ff97.edp: 
analogix_dp_read_bytes_from_dpcd: Aux Transaction fail!

[   14.183109] YKK - analogix_dp_bridge_pre_enable:1147
[   14.306301] rockchip-dp ff97.edp: Link Training Clock Recovery 
success

[   14.319130] rockchip-dp ff97.edp: Link Training success!
[   14.326388] rockchip-dp ff97.edp: wait SYS_CTL_2.
[   14.437247] rockchip-dp ff97.edp: Timeout of video streamclk ok
[   14.443585] rockchip-dp ff97.edp: unable to config video



  }
  
  static void analogix_dp_connector_destroy(struct drm_connector *connector)

@@ -1035,6 +1051,18 @@ static int analogix_dp_bridge_attach(struct drm_bridge 
*bridge)
return 0;
  }
  
+static void analogix_dp_bridge_pre_enable(struct drm_bridge *bridge)

+{
+   struct analogix_dp_device *dp = bridge->driver_private;
+   int ret;
+
+   if (dp->plat_data->panel) {
+   ret = drm_panel_prepare(dp->plat_data->panel);
+   if (ret)
+   DRM_ERROR("failed to setup the panel ret = %d\n", ret);
+   }


2. Driver would failed to read EDID in some case. Panel would only be 
powered up in bridge->pre_enable() function which later than 
connector->get_modes() function, and this would caused DPCD transfer 
failed in analogix_dp_handle_edid(). This seem won't caused too big 
issue, cause userspace would read EDID again after bridge/encoder is 
enabled. But it's better to avoid this potential bug.



[   11.065267] YKK - analogix_dp_detect:1052
[   11.729596] YKK - analogix_dp_get_modes:1016
[   11.737608] rockchip-dp ff97.edp: 
analogix_dp_read_bytes_from_dpcd: Aux Transaction fail!
[   11.749229] rockchip-dp ff97.edp: 
analogix_dp_read_bytes_from_dpcd: Aux Transaction fail!
[   11.760799] 

[PATCH] Suppress warnings when compiling fs/proc/task_mmu.c with W=1

2016-07-31 Thread Valdis Kletnieks
Suppress a bunch of warnings of the form:

fs/proc/task_mmu.c: In function 'show_smap_vma_flags':
fs/proc/task_mmu.c:635:22: warning: initialized field overwritten [-Wt 
override-init]
   [ilog2(VM_READ)] = "rd",
  ^~~~
fs/proc/task_mmu.c:635:22: note: (near initialization for 'mnemonics[0]')

They happen because of the way we intentionally build the table, so
silence the warning when building with 'make W=1'.

Signed-off-by: Valdis Kletnieks 

diff --git a/fs/proc/Makefile b/fs/proc/Makefile
index 7151ea428041..a8c13605b434 100644
--- a/fs/proc/Makefile
+++ b/fs/proc/Makefile
@@ -4,6 +4,7 @@
 
 obj-y   += proc.o
 
+CFLAGS_task_mmu.o  += -Wno-override-init
 proc-y := nommu.o task_nommu.o
 proc-$(CONFIG_MMU) := task_mmu.o
 




  1   2   3   4   5   >