Re: [PATCH v3] staging: rtl8192u: fix sparse warnings

2014-12-03 Thread Sudip Mukherjee
On Thu, Dec 04, 2014 at 10:50:43AM +0800, Fred Chou wrote:
> From: Fred Chou 
> 
> Fixed the following warnings in sparse:
> 
> drivers/staging/rtl8192u/r8192U_core.c:670:6: warning:
>   symbol 'dump_eprom' was not declared.
>   Should it be static?
> drivers/staging/rtl8192u/r8192U_core.c:1489:5: warning:
>   symbol 'ComputeTxTime' was not declared.
>   Should it be static?
> drivers/staging/rtl8192u/r8192U_core.c:1556:14: warning:
>   symbol 'txqueue2outpipe' was not declared.
>   Should it be static?
> drivers/staging/rtl8192u/r8192U_core.c:4876:5: warning:
>   symbol 'GetRxPacketShiftBytes819xUsb' was not declared.
>   Should it be static?
> 
> Signed-off-by: Fred Chou 
> 
> ---
> change in v3: fixed alignment to match open parenthesis 
have u fixed?
your v2 was having one problem of alignment, but v3 is again having 3 problems.

and your patch doesnot apply to next-20141203

sudip

> 
>  drivers/staging/rtl8192u/r8192U_core.c | 12 +++-
>  1 file changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/staging/rtl8192u/r8192U_core.c 
> b/drivers/staging/rtl8192u/r8192U_core.c
> index 7640386..2c61801 100644
> --- a/drivers/staging/rtl8192u/r8192U_core.c
> +++ b/drivers/staging/rtl8192u/r8192U_core.c
> @@ -667,7 +667,7 @@ static void tx_timeout(struct net_device *dev)
>  
>  
>  /* this is only for debug */
> -void dump_eprom(struct net_device *dev)
> +static void dump_eprom(struct net_device *dev)
>  {
>   int i;
>   for (i = 0; i < 63; i++)
> @@ -1486,8 +1486,8 @@ inline u8 rtl8192_IsWirelessBMode(u16 rate)
>  
>  u16 N_DBPSOfRate(u16 DataRate);
>  
> -u16 ComputeTxTime(u16 FrameLength, u16 DataRate, u8 bManagementFrame,
> -   u8 bShortPreamble)
> +static u16 ComputeTxTime(u16 FrameLength, u16 DataRate, u8 bManagementFrame,
> +   u8 bShortPreamble)
>  {
>   u16 FrameTime;
>   u16 N_DBPS;
> @@ -1553,7 +1553,8 @@ u16 N_DBPSOfRate(u16 DataRate)
>   return N_DBPS;
>  }
>  
> -unsigned int txqueue2outpipe(struct r8192_priv *priv, unsigned int tx_queue)
> +static unsigned int txqueue2outpipe(struct r8192_priv *priv,
> +  unsigned int tx_queue)
>  {
>   if (tx_queue >= 9) {
>   RT_TRACE(COMP_ERR, "%s():Unknown queue ID!!!\n", __func__);
> @@ -4873,7 +4874,8 @@ static void query_rxdesc_status(struct sk_buff *skb,
>  
>  }
>  
> -u32 GetRxPacketShiftBytes819xUsb(struct ieee80211_rx_stats  *Status, bool 
> bIsRxAggrSubframe)
> +static u32 GetRxPacketShiftBytes819xUsb(struct ieee80211_rx_stats  *Status,
> +  bool bIsRxAggrSubframe)
>  {
>  #ifdef USB_RX_AGGREGATION_SUPPORT
>   if (bIsRxAggrSubframe)
> -- 
> 1.9.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: Ralink 6570 / Mediatek MT7601STA (was Re: Addition of a wifi kernel module to the linux source tree)

2014-12-03 Thread Julian Calaby
Hi Greg,

On Thu, Dec 4, 2014 at 3:39 PM, Greg Kroah-Hartman
 wrote:
> On Thu, Dec 04, 2014 at 07:07:58AM +0530, Parth Sane wrote:
>> Hi,
>> I'd say I'm midway through with c programming(part of my computer
>> engineering degree course) and know a decent amount of git. So yes I'm
>> comfortable writing code.
>
> Ok great, let's see if it's just a matter of some changes to the
> existing kernel driver before we decide to add the whole huge tarball
> to the staging tree as fixing it up will be a lot of work.

I believe some people (CC'd) may have been working on / had an
interest in writing such a driver. I'm not sure what the status of
that effort is though.

Thanks,

-- 
Julian Calaby

Email: julian.cal...@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: Ralink 6570 / Mediatek MT7601STA (was Re: Addition of a wifi kernel module to the linux source tree)

2014-12-03 Thread Greg Kroah-Hartman
On Thu, Dec 04, 2014 at 07:07:58AM +0530, Parth Sane wrote:
> Hi,
> I'd say I'm midway through with c programming(part of my computer
> engineering degree course) and know a decent amount of git. So yes I'm
> comfortable writing code.

Ok great, let's see if it's just a matter of some changes to the
existing kernel driver before we decide to add the whole huge tarball
to the staging tree as fixing it up will be a lot of work.

> Also here's the link to an eBay listing for the same hardware.
> http://www.ebay.com/itm/like/231051816145?lpid=82&item=231051816145&lgeo=1&vectorid=229466

Thanks, I've ordered a few that look like this, hopefully some will
actually show up.

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3] staging: rtl8192u: fix sparse warnings

2014-12-03 Thread Fred Chou
From: Fred Chou 

Fixed the following warnings in sparse:

drivers/staging/rtl8192u/r8192U_core.c:670:6: warning:
symbol 'dump_eprom' was not declared.
Should it be static?
drivers/staging/rtl8192u/r8192U_core.c:1489:5: warning:
symbol 'ComputeTxTime' was not declared.
Should it be static?
drivers/staging/rtl8192u/r8192U_core.c:1556:14: warning:
symbol 'txqueue2outpipe' was not declared.
Should it be static?
drivers/staging/rtl8192u/r8192U_core.c:4876:5: warning:
symbol 'GetRxPacketShiftBytes819xUsb' was not declared.
Should it be static?

Signed-off-by: Fred Chou 

---
change in v3: fixed alignment to match open parenthesis 

 drivers/staging/rtl8192u/r8192U_core.c | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U_core.c 
b/drivers/staging/rtl8192u/r8192U_core.c
index 7640386..2c61801 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -667,7 +667,7 @@ static void tx_timeout(struct net_device *dev)
 
 
 /* this is only for debug */
-void dump_eprom(struct net_device *dev)
+static void dump_eprom(struct net_device *dev)
 {
int i;
for (i = 0; i < 63; i++)
@@ -1486,8 +1486,8 @@ inline u8 rtl8192_IsWirelessBMode(u16 rate)
 
 u16 N_DBPSOfRate(u16 DataRate);
 
-u16 ComputeTxTime(u16 FrameLength, u16 DataRate, u8 bManagementFrame,
- u8 bShortPreamble)
+static u16 ComputeTxTime(u16 FrameLength, u16 DataRate, u8 bManagementFrame,
+ u8 bShortPreamble)
 {
u16 FrameTime;
u16 N_DBPS;
@@ -1553,7 +1553,8 @@ u16 N_DBPSOfRate(u16 DataRate)
return N_DBPS;
 }
 
-unsigned int txqueue2outpipe(struct r8192_priv *priv, unsigned int tx_queue)
+static unsigned int txqueue2outpipe(struct r8192_priv *priv,
+unsigned int tx_queue)
 {
if (tx_queue >= 9) {
RT_TRACE(COMP_ERR, "%s():Unknown queue ID!!!\n", __func__);
@@ -4873,7 +4874,8 @@ static void query_rxdesc_status(struct sk_buff *skb,
 
 }
 
-u32 GetRxPacketShiftBytes819xUsb(struct ieee80211_rx_stats  *Status, bool 
bIsRxAggrSubframe)
+static u32 GetRxPacketShiftBytes819xUsb(struct ieee80211_rx_stats  *Status,
+bool bIsRxAggrSubframe)
 {
 #ifdef USB_RX_AGGREGATION_SUPPORT
if (bIsRxAggrSubframe)
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/1] Staging: ft1000: fix some coding style issues

2014-12-03 Thread Joe Perches
On Wed, 2014-12-03 at 20:49 -0500, Kevin Pietsch wrote:
> Removed braces from two single line if-else statements

Another perhaps better option is to use ?: like:
---
 drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c | 14 --
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c 
b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c
index 0038a3a..8743516 100644
--- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c
+++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c
@@ -172,11 +172,8 @@ u16 ft1000_read_dpram_mag_16(struct net_device *dev, int 
offset, int Index)
spin_lock_irqsave(&info->dpram_lock, flags);
ft1000_write_reg(dev, FT1000_REG_DPRAM_ADDR, offset);
/* check if we want to read upper or lower 32-bit word */
-   if (Index) {
-   data = ft1000_read_reg(dev, FT1000_REG_MAG_DPDATAL);
-   } else {
-   data = ft1000_read_reg(dev, FT1000_REG_MAG_DPDATAH);
-   }
+   data = ft1000_read_reg(dev, index ? FT1000_REG_MAG_DPDATAL
+ : FT1000_REG_MAG_DPDATAH);
spin_unlock_irqrestore(&info->dpram_lock, flags);
 
return data;
@@ -204,11 +201,8 @@ static inline void ft1000_write_dpram_mag_16(struct 
net_device *dev,
/* Provide mutual exclusive access while reading ASIC registers. */
spin_lock_irqsave(&info->dpram_lock, flags);
ft1000_write_reg(dev, FT1000_REG_DPRAM_ADDR, offset);
-   if (Index) {
-   ft1000_write_reg(dev, FT1000_REG_MAG_DPDATAL, value);
-   } else {
-   ft1000_write_reg(dev, FT1000_REG_MAG_DPDATAH, value);
-   }
+   ft1000_write_reg(dev, index ? FT1000_REG_MAG_DPDATAL
+   : FT1000_REG_MAG_DPDATAH, value);
spin_unlock_irqrestore(&info->dpram_lock, flags);
 }
 


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] Staging: bcm: Fix lines exceeding 80 character limit in CmHost.h This is a patch to CmHost.h that fixes Exceeds 80 Character limits warning found by checkpatch.pl Signed-off-by: Arun Ayyer

2014-12-03 Thread arun vijayshankar
Thanks Greg and Joe!

I will work against -next

Regards,
Arun.

On Wed, Dec 3, 2014 at 5:43 PM, Joe Perches  wrote:
>
> On Wed, 2014-12-03 at 17:39 -0800, Greg KH wrote:
> > On Wed, Dec 03, 2014 at 05:31:59PM -0800, arun vijayshankar wrote:
> > > Hi Greg,
> >
> > If you turn off HTML email, your message will not get rejected by the
> > mailing lists :)
> >
> > > I completely agree! I thought of keeping the patch summary as the 
> > > subject, but
> > > I wasn't sure and ending up entering nothing. Git then used this by 
> > > default.
> >
> > You forgot a blank line after your first line in the git commit message,
> > which caused it to get all merged together.
> >
> > Try fixing that up and resending please.
>
> No need.  This directory has been deleted.
>
> Please work against -next (or Greg's staging tree)
>
>



-- 
Arun.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/1] Staging: ft1000: fix some coding style issues

2014-12-03 Thread Kevin Pietsch
Removed braces from two single line if-else statements

Signed-off-by: Kevin Pietsch 
---
 drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c | 10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c 
b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c
index 44575c7..fadd47d 100644
--- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c
+++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c
@@ -176,11 +176,10 @@ u16 ft1000_read_dpram_mag_16(struct net_device *dev, int 
offset, int Index)
spin_lock_irqsave(&info->dpram_lock, flags);
ft1000_write_reg(dev, FT1000_REG_DPRAM_ADDR, offset);
/* check if we want to read upper or lower 32-bit word */
-   if (Index) {
+   if (Index)
data = ft1000_read_reg(dev, FT1000_REG_MAG_DPDATAL);
-   } else {
+   else
data = ft1000_read_reg(dev, FT1000_REG_MAG_DPDATAH);
-   }
spin_unlock_irqrestore(&info->dpram_lock, flags);
 
return data;
@@ -208,11 +207,10 @@ static inline void ft1000_write_dpram_mag_16(struct 
net_device *dev,
/* Provide mutual exclusive access while reading ASIC registers. */
spin_lock_irqsave(&info->dpram_lock, flags);
ft1000_write_reg(dev, FT1000_REG_DPRAM_ADDR, offset);
-   if (Index) {
+   if (Index)
ft1000_write_reg(dev, FT1000_REG_MAG_DPDATAL, value);
-   } else {
+   else
ft1000_write_reg(dev, FT1000_REG_MAG_DPDATAH, value);
-   }
spin_unlock_irqrestore(&info->dpram_lock, flags);
 }
 
-- 
2.1.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] Staging: bcm: Fix lines exceeding 80 character limit in CmHost.h This is a patch to CmHost.h that fixes Exceeds 80 Character limits warning found by checkpatch.pl Signed-off-by: Arun Ayyer

2014-12-03 Thread Joe Perches
On Wed, 2014-12-03 at 17:39 -0800, Greg KH wrote:
> On Wed, Dec 03, 2014 at 05:31:59PM -0800, arun vijayshankar wrote:
> > Hi Greg,
> 
> If you turn off HTML email, your message will not get rejected by the
> mailing lists :)
> 
> > I completely agree! I thought of keeping the patch summary as the subject, 
> > but
> > I wasn't sure and ending up entering nothing. Git then used this by default.
> 
> You forgot a blank line after your first line in the git commit message,
> which caused it to get all merged together.
> 
> Try fixing that up and resending please.

No need.  This directory has been deleted.

Please work against -next (or Greg's staging tree)


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] Staging: bcm: Fix lines exceeding 80 character limit in CmHost.h This is a patch to CmHost.h that fixes Exceeds 80 Character limits warning found by checkpatch.pl Signed-off-by: Arun Ayyer

2014-12-03 Thread Greg KH
On Wed, Dec 03, 2014 at 05:31:59PM -0800, arun vijayshankar wrote:
> Hi Greg,

If you turn off HTML email, your message will not get rejected by the
mailing lists :)

> I completely agree! I thought of keeping the patch summary as the subject, but
> I wasn't sure and ending up entering nothing. Git then used this by default.

You forgot a blank line after your first line in the git commit message,
which caused it to get all merged together.

Try fixing that up and resending please.

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: Ralink 6570 / Mediatek MT7601STA (was Re: Addition of a wifi kernel module to the linux source tree)

2014-12-03 Thread Parth Sane
Hi,
I'd say I'm midway through with c programming(part of my computer
engineering degree course) and know a decent amount of git. So yes I'm
comfortable writing code.
Also here's the link to an eBay listing for the same hardware.
http://www.ebay.com/itm/like/231051816145?lpid=82&item=231051816145&lgeo=1&vectorid=229466

I think that should do the trick.
Cheers,
-Parth

On 04/12/2014, Greg Kroah-Hartman  wrote:
> On Sun, Nov 30, 2014 at 06:55:12PM +, Parth Sane wrote:
>> Hi Greg,
>> You can find the source code attached as a tarball. It works and I have
>> tested
>> it myself. You only need to use make and make install for this.
>
> This really looks like a variant of some existing devices, the rt2x00,
> Ralink driver.
>
> I've copied the maintainers of that driver here.
>
> Is anyone working on support for the following devices in the existing
> rt2x00 USB driver:
>
> {USB_DEVICE(0x148f, 0x6570)}, /* Ralink 6570 */
> {USB_DEVICE(0x148f, 0x7650)}, /* MT7650 */
> {USB_DEVICE(0x148f, 0x6370)}, /* Ralink 6370 */
> {USB_DEVICE(0x148f, 0x7601)}, /* MT 6370 */
>
> thanks,
>
> greg k-h
>
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] Staging: bcm: Fix lines exceeding 80 character limit in CmHost.h This is a patch to CmHost.h that fixes Exceeds 80 Character limits warning found by checkpatch.pl Signed-off-by: Arun Ayyer

2014-12-03 Thread Greg KH
On Wed, Dec 03, 2014 at 05:12:09PM -0800, Arun wrote:
> ---
>  drivers/staging/bcm/CmHost.h |8 +---
>  1 file changed, 5 insertions(+), 3 deletions(-)

That's a really odd subject, don't you agree?

:)

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Ralink 6570 / Mediatek MT7601STA (was Re: Addition of a wifi kernel module to the linux source tree)

2014-12-03 Thread Greg Kroah-Hartman
On Sun, Nov 30, 2014 at 06:55:12PM +, Parth Sane wrote:
> Hi Greg,
> You can find the source code attached as a tarball. It works and I have tested
> it myself. You only need to use make and make install for this.

This really looks like a variant of some existing devices, the rt2x00,
Ralink driver.

I've copied the maintainers of that driver here.

Is anyone working on support for the following devices in the existing
rt2x00 USB driver:

{USB_DEVICE(0x148f, 0x6570)}, /* Ralink 6570 */
{USB_DEVICE(0x148f, 0x7650)}, /* MT7650 */
{USB_DEVICE(0x148f, 0x6370)}, /* Ralink 6370 */
{USB_DEVICE(0x148f, 0x7601)}, /* MT 6370 */

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: PATCH

2014-12-03 Thread Greg Kroah-Hartman
On Mon, Dec 01, 2014 at 11:05:10AM +0530, Parth Sane wrote:
> Hi Greg,
> I have looked at the patches and documentation on how to proceed
> forward. But I have a doubt. Was hoping you could make it clear for
> me. You have said that you don't want unnecessary binary firmware
> files in the source which is really good. But if I how do I know which
> binary files are required or not? This is nearly impossible for me to
> guess this, since I haven't written the driver.
> Please help me out with this.

How comfortable are you with C?  How about kernel code and patches?  If
you aren't that familiar, this is going to be a tough learning curve,
and we should try to find someone else who can help out here.

What type of device is this, can I go buy one somewhere to help test /
cleanup the driver?

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: Possible memory leak in function (reserve_range) not freeing pointer (regionid)

2014-12-03 Thread Greg KH
On Sun, Nov 30, 2014 at 09:49:23PM -0600, Ahmed Tamrawi wrote:
> On Sun, Nov 30, 2014 at 8:51 PM, Greg KH  wrote:
> > On Sun, Nov 30, 2014 at 02:00:45PM -0600, Ahmed Tamrawi wrote:
> >> Bug Report: https://bugzilla.kernel.org/show_bug.cgi?id=89101
> >> Linux Version [3.17-rc1]
> >
> > That's a very old kernel version.
> It does exist on the latest version (v3.18-rc7)

Good to know.

> >> Configuration: Default configuration for x86
> >>
> >>
> >> Function (reserve_range) in file (drivers/pnp/system.c) allocates
> >> pointer (regionid) on line (32) and passes it to function
> >> (__request_region) through the macros: (request_region) at line (38)
> >> or (request_mem_region) at line (40). However, if the resource (res)
> >> is allocated through (__request_region) function, then the pointer
> >> (res->name) points to the allocated pointer (regionid). Then, there is
> >> no way in function (free_resource) or function (release_resource) to
> >> free the pointer (regionid) or (res->name). Thus, causing a potential
> >> memory leak!
> >
> > How does this relate to the mailing list you sent this to?
> The bug occurs in the drivers side code in pnp/system.c. I thought
> this is the list to target. I have already posted the bug into
> linux-kernel mailing list, does that suffice?

Use the tool, scripts/get_maintainer.pl to determine what people and
mailing lists to send issues to for specific files.  Just sending them
to random mailing lists without cc: developers is a sure way to get them
ignored.

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Staging: bcm: Fix lines exceeding 80 character limit in CmHost.h This is a patch to CmHost.h that fixes Exceeds 80 Character limits warning found by checkpatch.pl Signed-off-by: Arun Ayyer

2014-12-03 Thread Arun
---
 drivers/staging/bcm/CmHost.h |8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/bcm/CmHost.h b/drivers/staging/bcm/CmHost.h
index 0887d3f..a6e30da 100644
--- a/drivers/staging/bcm/CmHost.h
+++ b/drivers/staging/bcm/CmHost.h
@@ -20,8 +20,8 @@
 #pragma once
 #pragma pack(push, 4)
 
-#define DSX_MESSAGE_EXCHANGE_BUFFER0xBF60AC84 /* This contains the 
pointer */
-#define DSX_MESSAGE_EXCHANGE_BUFFER_SIZE   72000  /* 24 K Bytes */
+#define DSX_MESSAGE_EXCHANGE_BUFFER   0xBF60AC84 /* Contains the pointer */
+#define DSX_MESSAGE_EXCHANGE_BUFFER_SIZE  72000  /* 24 K Bytes */
 
 struct bcm_add_indication_alt {
u8  u8Type;
@@ -51,7 +51,9 @@ struct bcm_change_indication {
u16 u16Padd;
 };
 
-unsigned long StoreCmControlResponseMessage(struct bcm_mini_adapter *Adapter, 
void *pvBuffer, unsigned int *puBufferLength);
+unsigned long StoreCmControlResponseMessage(struct bcm_mini_adapter *Adapter,
+   void *pvBuffer,
+   unsigned int *puBufferLength);
 int AllocAdapterDsxBuffer(struct bcm_mini_adapter *Adapter);
 int FreeAdapterDsxBuffer(struct bcm_mini_adapter *Adapter);
 unsigned long SetUpTargetDsxBuffers(struct bcm_mini_adapter *Adapter);
-- 
1.7.9.5

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v16 03/12] drm: imx: imx-hdmi: convert imx-hdmi to drm_bridge mode

2014-12-03 Thread Andy Yan

Hi Russel:
On 2014年12月04日 07:40, Russell King - ARM Linux wrote:

On Thu, Dec 04, 2014 at 12:56:24AM +0800, Andy Yan wrote:

Hi Russell:
On 2014年12月04日 00:33, Russell King - ARM Linux wrote:

On Thu, Dec 04, 2014 at 12:30:23AM +0800, Andy Yan wrote:

On 2014年12月04日 00:11, Russell King - ARM Linux wrote:

I meant that imx_hdmi_bind should be passed these, so that it needs to
know nothing about the struct device beyond the generic device structure.
In other words, the dw-hdmi core should not assume that the struct device
is part of a platform device.


if so, how about the device tree properties  ddc-i2c-bus, reg-io-width,
iahb, isfr,
   they are all found by device?

If the device has a device tree node associated with it, it will have a
non-NULL dev->of_node - which is part of the generic device structure.


   so , I just need get the resource and irq number in the
dw_hdmi-imx/rockchip ,than
   pass them to imx_hdmi_bind, as the properties ddc-i2c-bus, reg-io-width,
iahb,isfr, they
   are still can be handled in imx_hdmi_bind ?

Basically, what I'm suggesting is just this change to imx_hdmi_bind():

  int imx_hdmi_bind(struct device *dev, struct device *master,
  void *data, struct drm_encoder *encoder,
+ const struct resource *iores, int irq,
  const struct imx_hdmi_plat_data *plat_data)
  {
-   struct platform_device *pdev = to_platform_device(dev);
...
}

-   irq = platform_get_irq(pdev, 0);
if (irq < 0)
return irq;
...
return ret;

-   iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
hdmi->regs = devm_ioremap_resource(dev, iores);
if (IS_ERR(hdmi->regs))

and supplying those as arguments from the caller.


  got it, thanks, and also many thanks for Philipp


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2] Staging: dgnc: Fix long line coding style issues in dgnc_cls.h

2014-12-03 Thread Joe Perches
On Wed, 2014-12-03 at 21:30 +, Sean Cleator wrote:
> A patch to fix the rest of the long line warnings in the dgnc_cls.h file
> found by the checkpatch.pl tool

checkpatch is a brainless little tool.

You should prefer to develop a readable style rather than
pay too close attention to precisely what checkpatch says.

fyi: There is this warning in the file:

 *  NOTE: THIS IS A SHARED HEADER. DO NOT CHANGE CODING STYLE!!!

I would have done changes like this:
---
 drivers/staging/dgnc/dgnc_cls.h | 45 -
 1 file changed, 22 insertions(+), 23 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_cls.h b/drivers/staging/dgnc/dgnc_cls.h
index 465d79a..db05aed 100644
--- a/drivers/staging/dgnc/dgnc_cls.h
+++ b/drivers/staging/dgnc/dgnc_cls.h
@@ -25,25 +25,24 @@
 
 #include "dgnc_types.h"
 
-
-/
- * Per channel/port Classic UART structure *
- 
- * Base Structure Entries Usage Meanings to Host   *
- * *
- * W = read write  R = read only   *
- * U = Unused. *
- /
+/*
+ * Per channel/port classic UART registers structure
+ *
+ * Base structure entries usage - meaning to host:
+ * W = read write
+ * R = read only
+ * U = unused
+ */
 
 struct cls_uart_struct {
-   u8 txrx;/* WR  RHR/THR - Holding Reg */
-   u8 ier; /* WR  IER - Interrupt Enable Reg */
-   u8 isr_fcr; /* WR  ISR/FCR - Interrupt Status Reg/Fifo 
Control Reg */
-   u8 lcr; /* WR  LCR - Line Control Reg */
-   u8 mcr; /* WR  MCR - Modem Control Reg */
-   u8 lsr; /* WR  LSR - Line Status Reg */
-   u8 msr; /* WR  MSR - Modem Status Reg */
-   u8 spr; /* WR  SPR - Scratch Pad Reg */
+   u8 txrx;/* WR  RHR/THR - Holding */
+   u8 ier; /* WR  IER - Interrupt Enable */
+   u8 isr_fcr; /* WR  ISR/FCR - Interrupt Status / Fifo Control */
+   u8 lcr; /* WR  LCR - Line Control */
+   u8 mcr; /* WR  MCR - Modem Control */
+   u8 lsr; /* WR  LSR - Line Status */
+   u8 msr; /* WR  MSR - Modem Status */
+   u8 spr; /* WR  SPR - Scratch Pad */
 };
 
 /* Where to read the interrupt register (8bits) */
@@ -61,12 +60,12 @@ struct cls_uart_struct {
 #define UART_16654_FCR_RXTRIGGER_560x80
 #define UART_16654_FCR_RXTRIGGER_60 0xC0
 
-#define UART_IIR_CTSRTS0x20/* Received CTS/RTS 
change of state */
-#define UART_IIR_RDI_TIMEOUT   0x0C/* Receiver data TIMEOUT */
+#define UART_IIR_CTSRTS0x20/* Received CTS/RTS change of 
state */
+#define UART_IIR_RDI_TIMEOUT   0x0C/* Receiver data TIMEOUT */
 
 /*
- * These are the EXTENDED definitions for the Exar 654's Interrupt
- * Enable Register.
+ * These are the EXTENDED definitions for the
+ * Exar 654's Interrupt Enable Register
  */
 #define UART_EXAR654_EFR_ECB  0x10/* Enhanced control bit */
 #define UART_EXAR654_EFR_IXON 0x2 /* Receiver compares Xon1/Xoff1 */
@@ -74,8 +73,8 @@ struct cls_uart_struct {
 #define UART_EXAR654_EFR_RTSDTR   0x40/* Auto RTS/DTR Flow Control Enable 
*/
 #define UART_EXAR654_EFR_CTSDSR   0x80/* Auto CTS/DSR Flow COntrol Enable 
*/
 
-#define UART_EXAR654_XOFF_DETECT  0x1 /* Indicates whether chip saw an 
incoming XOFF char  */
-#define UART_EXAR654_XON_DETECT   0x2 /* Indicates whether chip saw an 
incoming XON char */
+#define UART_EXAR654_XOFF_DETECT  0x1 /* Incoming XOFF char seen */
+#define UART_EXAR654_XON_DETECT   0x2 /* Incoming XON char seen */
 
 #define UART_EXAR654_IER_XOFF 0x20/* Xoff Interrupt Enable */
 #define UART_EXAR654_IER_RTSDTR   0x40/* Output Interrupt Enable */


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v16 03/12] drm: imx: imx-hdmi: convert imx-hdmi to drm_bridge mode

2014-12-03 Thread Russell King - ARM Linux
On Thu, Dec 04, 2014 at 12:56:24AM +0800, Andy Yan wrote:
> Hi Russell:
> On 2014年12月04日 00:33, Russell King - ARM Linux wrote:
> >On Thu, Dec 04, 2014 at 12:30:23AM +0800, Andy Yan wrote:
> >>On 2014年12月04日 00:11, Russell King - ARM Linux wrote:
> >>>I meant that imx_hdmi_bind should be passed these, so that it needs to
> >>>know nothing about the struct device beyond the generic device structure.
> >>>In other words, the dw-hdmi core should not assume that the struct device
> >>>is part of a platform device.
> >>>
> >>if so, how about the device tree properties  ddc-i2c-bus, reg-io-width,
> >>iahb, isfr,
> >>   they are all found by device?
> >If the device has a device tree node associated with it, it will have a
> >non-NULL dev->of_node - which is part of the generic device structure.
> >
>   so , I just need get the resource and irq number in the
> dw_hdmi-imx/rockchip ,than
>   pass them to imx_hdmi_bind, as the properties ddc-i2c-bus, reg-io-width,
> iahb,isfr, they
>   are still can be handled in imx_hdmi_bind ?

Basically, what I'm suggesting is just this change to imx_hdmi_bind():

 int imx_hdmi_bind(struct device *dev, struct device *master,
  void *data, struct drm_encoder *encoder,
+ const struct resource *iores, int irq,
  const struct imx_hdmi_plat_data *plat_data)
 {
-   struct platform_device *pdev = to_platform_device(dev);
...
}

-   irq = platform_get_irq(pdev, 0);
if (irq < 0)
return irq;
...
return ret;

-   iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
hdmi->regs = devm_ioremap_resource(dev, iores);
if (IS_ERR(hdmi->regs))

and supplying those as arguments from the caller.

-- 
FTTC broadband for 0.8mile line: currently at 9.5Mbps down 400kbps up
according to speedtest.net.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Staging: octeon: Added blank lines after declarations

2014-12-03 Thread Jamie Lawler
Hi,
There are 2 missing blank lines after declarations in
octeon/ethernet-rx.c. I have added them per the coding style.

Regards,
Jamie Lawler

Signed-off-by: Jamie Lawler 
---
 drivers/staging/octeon/ethernet-rx.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/octeon/ethernet-rx.c 
b/drivers/staging/octeon/ethernet-rx.c
index 1789a12..cecb806 100644
--- a/drivers/staging/octeon/ethernet-rx.c
+++ b/drivers/staging/octeon/ethernet-rx.c
@@ -109,6 +109,7 @@ static inline int cvm_oct_check_rcv_error(cvmx_wqe_t *work)
int interface = cvmx_helper_get_interface_num(work->ipprt);
int index = cvmx_helper_get_interface_index_num(work->ipprt);
union cvmx_gmxx_rxx_frm_ctl gmxx_rxx_frm_ctl;
+
gmxx_rxx_frm_ctl.u64 =
cvmx_read_csr(CVMX_GMXX_RXX_FRM_CTL(index, interface));
if (gmxx_rxx_frm_ctl.s.pre_chk == 0) {
@@ -212,6 +213,7 @@ static int cvm_oct_napi_poll(struct napi_struct *napi, int 
budget)
did_work_request = 0;
if (work == NULL) {
union cvmx_pow_wq_int wq_int;
+
wq_int.u64 = 0;
wq_int.s.iq_dis = 1 << pow_receive_group;
wq_int.s.wq_int = 1 << pow_receive_group;
-- 
2.1.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] Staging: octeon: Added several blank lines after declarations

2014-12-03 Thread Jamie Lawler
Thanks Aaro, I will do that now.

Jamie

On 3 December 2014 at 22:13, Aaro Koskinen  wrote:
> Hi,
>
> On Wed, Dec 03, 2014 at 09:43:51PM +, Jamie Lawler wrote:
>> --- a/drivers/staging/octeon/ethernet-rx.c
>> +++ b/drivers/staging/octeon/ethernet-rx.c
>> @@ -84,6 +84,7 @@ static int cvm_irq_cpu;
>>  static void cvm_oct_enable_napi(void *_)
>>  {
>>   int cpu = smp_processor_id();
>> +
>>   napi_schedule(&cvm_oct_napi[cpu].napi);
>>  }
>
> This function has already been deleted from the staging tree.
> You need to refresh your patch and see if it's still relevant for
> the current tree.
>
> A.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] Staging: octeon: Added several blank lines after declarations

2014-12-03 Thread Aaro Koskinen
Hi,

On Wed, Dec 03, 2014 at 09:43:51PM +, Jamie Lawler wrote:
> --- a/drivers/staging/octeon/ethernet-rx.c
> +++ b/drivers/staging/octeon/ethernet-rx.c
> @@ -84,6 +84,7 @@ static int cvm_irq_cpu;
>  static void cvm_oct_enable_napi(void *_)
>  {
>   int cpu = smp_processor_id();
> +
>   napi_schedule(&cvm_oct_napi[cpu].napi);
>  }

This function has already been deleted from the staging tree.
You need to refresh your patch and see if it's still relevant for
the current tree.

A.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Staging: octeon: Added several blank lines after declarations

2014-12-03 Thread Jamie Lawler
Hi,
I've added blank lines after several declarations that were
previously missing them, reducing the number of warnings from
checkpatch.pl.

Regards,
Jamie Lawler

Signed-off-by: Jamie Lawler 
---
 drivers/staging/octeon/ethernet-rx.c |  4 
 drivers/staging/octeon/ethernet-tx.c | 11 +++
 2 files changed, 15 insertions(+)

diff --git a/drivers/staging/octeon/ethernet-rx.c 
b/drivers/staging/octeon/ethernet-rx.c
index b2b6c3c..758b4d9 100644
--- a/drivers/staging/octeon/ethernet-rx.c
+++ b/drivers/staging/octeon/ethernet-rx.c
@@ -84,6 +84,7 @@ static int cvm_irq_cpu;
 static void cvm_oct_enable_napi(void *_)
 {
int cpu = smp_processor_id();
+
napi_schedule(&cvm_oct_napi[cpu].napi);
 }
 
@@ -169,6 +170,7 @@ static inline int cvm_oct_check_rcv_error(cvmx_wqe_t *work)
int interface = cvmx_helper_get_interface_num(work->ipprt);
int index = cvmx_helper_get_interface_index_num(work->ipprt);
union cvmx_gmxx_rxx_frm_ctl gmxx_rxx_frm_ctl;
+
gmxx_rxx_frm_ctl.u64 =
cvmx_read_csr(CVMX_GMXX_RXX_FRM_CTL(index, interface));
if (gmxx_rxx_frm_ctl.s.pre_chk == 0) {
@@ -272,6 +274,7 @@ static int cvm_oct_napi_poll(struct napi_struct *napi, int 
budget)
did_work_request = 0;
if (work == NULL) {
union cvmx_pow_wq_int wq_int;
+
wq_int.u64 = 0;
wq_int.s.iq_dis = 1 << pow_receive_group;
wq_int.s.wq_int = 1 << pow_receive_group;
@@ -295,6 +298,7 @@ static int cvm_oct_napi_poll(struct napi_struct *napi, int 
budget)
union cvmx_pow_wq_int_cntx counts;
int backlog;
int cores_in_use = core_state.baseline_cores - 
atomic_read(&core_state.available_cores);
+
counts.u64 = 
cvmx_read_csr(CVMX_POW_WQ_INT_CNTX(pow_receive_group));
backlog = counts.s.iq_cnt + counts.s.ds_cnt;
if (backlog > budget * cores_in_use && napi != NULL)
diff --git a/drivers/staging/octeon/ethernet-tx.c 
b/drivers/staging/octeon/ethernet-tx.c
index 4e54d85..b7a7854 100644
--- a/drivers/staging/octeon/ethernet-tx.c
+++ b/drivers/staging/octeon/ethernet-tx.c
@@ -77,6 +77,7 @@ static DECLARE_TASKLET(cvm_oct_tx_cleanup_tasklet, 
cvm_oct_tx_do_cleanup, 0);
 static inline int32_t cvm_oct_adjust_skb_to_free(int32_t skb_to_free, int fau)
 {
int32_t undo;
+
undo = skb_to_free > 0 ? MAX_SKB_TO_FREE : skb_to_free +
   MAX_SKB_TO_FREE;
if (undo > 0)
@@ -89,6 +90,7 @@ static inline int32_t cvm_oct_adjust_skb_to_free(int32_t 
skb_to_free, int fau)
 static void cvm_oct_kick_tx_poll_watchdog(void)
 {
union cvmx_ciu_timx ciu_timx;
+
ciu_timx.u64 = 0;
ciu_timx.s.one_shot = 1;
ciu_timx.s.len = cvm_oct_tx_poll_interval;
@@ -118,9 +120,11 @@ static void cvm_oct_free_tx_skbs(struct net_device *dev)
total_freed += skb_to_free;
if (skb_to_free > 0) {
struct sk_buff *to_free_list = NULL;
+
spin_lock_irqsave(&priv->tx_free_list[qos].lock, flags);
while (skb_to_free > 0) {
struct sk_buff *t;
+
t = __skb_dequeue(&priv->tx_free_list[qos]);
t->next = to_free_list;
to_free_list = t;
@@ -131,6 +135,7 @@ static void cvm_oct_free_tx_skbs(struct net_device *dev)
/* Do the actual freeing outside of the lock. */
while (to_free_list) {
struct sk_buff *t = to_free_list;
+
to_free_list = to_free_list->next;
dev_kfree_skb_any(t);
}
@@ -258,6 +263,7 @@ int cvm_oct_xmit(struct sk_buff *skb, struct net_device 
*dev)
cvmx_read_csr(CVMX_GMXX_PRTX_CFG(index, interface));
if (gmx_prt_cfg.s.duplex == 0) {
int add_bytes = 64 - skb->len;
+
if ((skb_tail_pointer(skb) + add_bytes) <=
skb_end_pointer(skb))
memset(__skb_put(skb, add_bytes), 0,
@@ -289,6 +295,7 @@ int cvm_oct_xmit(struct sk_buff *skb, struct net_device 
*dev)
CVM_OCT_SKB_CB(skb)[0] = hw_buffer.u64;
for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
struct skb_frag_struct *fs = skb_shinfo(skb)->frags + i;
+
hw_buffer.s.addr = XKPHYS_TO_PHYS(
(u64)(page_address(fs->page.p) +
fs->page_offset));
@@ -495,6 +502,7 @@ skip_xmit:
 
while (skb

[PATCH v2] Staging: dgnc: Fix long line coding style issues in dgnc_cls.h

2014-12-03 Thread Sean Cleator
A patch to fix the rest of the long line warnings in the dgnc_cls.h file
found by the checkpatch.pl tool

Signed-off-by: Sean Cleator 
---
 drivers/staging/dgnc/dgnc_cls.h | 18 --
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_cls.h b/drivers/staging/dgnc/dgnc_cls.h
index 465d79a..ee7814b 100644
--- a/drivers/staging/dgnc/dgnc_cls.h
+++ b/drivers/staging/dgnc/dgnc_cls.h
@@ -36,9 +36,12 @@
  /
 
 struct cls_uart_struct {
-   u8 txrx;/* WR  RHR/THR - Holding Reg */
+   u8 txrx;/* WR  RHR/THR - Holding Reg */
u8 ier; /* WR  IER - Interrupt Enable Reg */
-   u8 isr_fcr; /* WR  ISR/FCR - Interrupt Status Reg/Fifo 
Control Reg */
+   u8 isr_fcr; /*
+* WR  ISR/FCR - Interrupt Status Reg/Fifo
+* Control Reg
+*/
u8 lcr; /* WR  LCR - Line Control Reg */
u8 mcr; /* WR  MCR - Modem Control Reg */
u8 lsr; /* WR  LSR - Line Status Reg */
@@ -61,8 +64,9 @@ struct cls_uart_struct {
 #define UART_16654_FCR_RXTRIGGER_560x80
 #define UART_16654_FCR_RXTRIGGER_60 0xC0
 
-#define UART_IIR_CTSRTS0x20/* Received CTS/RTS 
change of state */
-#define UART_IIR_RDI_TIMEOUT   0x0C/* Receiver data TIMEOUT */
+/* Received CTS/RTS change of state */
+#define UART_IIR_CTSRTS0x20
+#define UART_IIR_RDI_TIMEOUT   0x0C/* Receiver data TIMEOUT */
 
 /*
  * These are the EXTENDED definitions for the Exar 654's Interrupt
@@ -74,8 +78,10 @@ struct cls_uart_struct {
 #define UART_EXAR654_EFR_RTSDTR   0x40/* Auto RTS/DTR Flow Control Enable 
*/
 #define UART_EXAR654_EFR_CTSDSR   0x80/* Auto CTS/DSR Flow COntrol Enable 
*/
 
-#define UART_EXAR654_XOFF_DETECT  0x1 /* Indicates whether chip saw an 
incoming XOFF char  */
-#define UART_EXAR654_XON_DETECT   0x2 /* Indicates whether chip saw an 
incoming XON char */
+/* Indicates whether chip saw an incoming XOFF char */
+#define UART_EXAR654_XOFF_DETECT  0x1
+/* Indicates whether chip saw an incoming XON char */
+#define UART_EXAR654_XON_DETECT   0x2
 
 #define UART_EXAR654_IER_XOFF 0x20/* Xoff Interrupt Enable */
 #define UART_EXAR654_IER_RTSDTR   0x40/* Output Interrupt Enable */
-- 
2.1.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] Staging: dgnc: Fix long line coding style issues in dgnc_cls.h

2014-12-03 Thread Valdis . Kletnieks
On Wed, 03 Dec 2014 17:07:28 +, Sean Cleator said:
> A patch to fix the rest of the long line warnings in the dgnc_cls.h file
> found by the checkpatch.pl tool

>  struct cls_uart_struct {
>   u8 txrx;/* WR  RHR/THR - Holding Reg */
>   u8 ier; /* WR  IER - Interrupt Enable Reg */
> - u8 isr_fcr; /* WR  ISR/FCR - Interrupt Status Reg/Fifo 
> Control Reg */
> + u8 isr_fcr; /*
> +  * WR  ISR/FCR - Interrupt Status Reg/Fifo
> +  * Control Reg
> +  */
>   u8 lcr; /* WR  LCR - Line Control Reg */
>   u8 mcr; /* WR  MCR - Modem Control Reg */
>   u8 lsr; /* WR  LSR - Line Status Reg */

It may shut up the warning, but is this really an improvement?


pgp5MVOkyQD0L.pgp
Description: PGP signature
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: panel: Remove unused variable

2014-12-03 Thread Willy Tarreau
On Wed, Dec 03, 2014 at 07:53:47PM +0100, Mariusz Gorski wrote:
> Remove lcd.left_shift because it is only written to at some places but
> never read from.

Good catch, I think some code got dropped at some point because it
was used to shift the window of displayed text. Anyway nobody seems
to be missing it :-)

Acked-by: Willy Tarreau 

Willy

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] Staging: line6: fix parentheses around macro in usbdefs.h

2014-12-03 Thread Joe Perches
On Wed, 2014-12-03 at 19:34 +0100, Sam van Kampen wrote:
> This patch fixes the error "Macros with complex values should be enclosed in
> parentheses", as reported by checkpatch.pl.
[]
> diff --git a/drivers/staging/line6/usbdefs.h b/drivers/staging/line6/usbdefs.h
[]
> @@ -40,7 +40,7 @@
>  #define LINE6_DEVID_TONEPORT_UX2  0x4142
>  #define LINE6_DEVID_VARIAX0x534d
>  
> -#define LINE6_BIT(x) LINE6_BIT_ ## x = 1 << LINE6_INDEX_ ## x
> +#define LINE6_BIT(x) (LINE6_BIT_ ## x = 1 << LINE6_INDEX_ ## x)

The uses are pretty ugly.

It'd probably be nicer if all the LINE6_BIT uses were
direct enum declarations instead.



___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Staging: line6: fix parentheses around macro in usbdefs.h

2014-12-03 Thread Sam van Kampen
This patch fixes the error "Macros with complex values should be enclosed in
parentheses", as reported by checkpatch.pl.

Signed-off-by: Sam van Kampen 
---
 drivers/staging/line6/usbdefs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/line6/usbdefs.h b/drivers/staging/line6/usbdefs.h
index 2d1cc47..48958b5 100644
--- a/drivers/staging/line6/usbdefs.h
+++ b/drivers/staging/line6/usbdefs.h
@@ -40,7 +40,7 @@
 #define LINE6_DEVID_TONEPORT_UX2  0x4142
 #define LINE6_DEVID_VARIAX0x534d
 
-#define LINE6_BIT(x) LINE6_BIT_ ## x = 1 << LINE6_INDEX_ ## x
+#define LINE6_BIT(x) (LINE6_BIT_ ## x = 1 << LINE6_INDEX_ ## x)
 
 enum {
LINE6_INDEX_BASSPODXT,
-- 
2.0.4
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: panel: Remove unused variable

2014-12-03 Thread Mariusz Gorski
Remove lcd.left_shift because it is only written to at some places but
never read from.

Signed-off-by: Mariusz Gorski 
---
 drivers/staging/panel/panel.c | 6 --
 1 file changed, 6 deletions(-)

diff --git a/drivers/staging/panel/panel.c b/drivers/staging/panel/panel.c
index 98325b7..b68a9c3 100644
--- a/drivers/staging/panel/panel.c
+++ b/drivers/staging/panel/panel.c
@@ -228,9 +228,6 @@ static struct {
bool initialized;
bool must_clear;
 
-   /* TODO: use bool here? */
-   char left_shift;
-
int height;
int width;
int bwidth;
@@ -1135,12 +1132,10 @@ static inline int handle_lcd_special_code(void)
processed = 1;
break;
case 'L':   /* shift display left */
-   lcd.left_shift++;
lcd_write_cmd(0x18);
processed = 1;
break;
case 'R':   /* shift display right */
-   lcd.left_shift--;
lcd_write_cmd(0x1C);
processed = 1;
break;
@@ -1157,7 +1152,6 @@ static inline int handle_lcd_special_code(void)
}
case 'I':   /* reinitialize display */
lcd_init_display();
-   lcd.left_shift = 0;
processed = 1;
break;
case 'G': {
-- 
2.1.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 11/11] staging: comedi: addi_apci_1500: handle shared interrupt

2014-12-03 Thread H Hartley Sweeten
The interrupt used by this driver is shared. If the board did not cause
the interrupt the driver should return IRQ_NONE so that another driver
can handle it. Fix the interrupt handler so this happens.

Tidy up the interrupt handler a bit.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 .../comedi/drivers/addi-data/hwdrv_apci1500.c  | 171 ++---
 1 file changed, 80 insertions(+), 91 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c 
b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
index 35281fb..5bf943d 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
@@ -1483,115 +1483,104 @@ static irqreturn_t apci1500_interrupt(int irq, void 
*d)
 
struct comedi_device *dev = d;
struct apci1500_private *devpriv = dev->private;
-   unsigned int status;
-   int i_RegValue = 0;
+   unsigned int val;
 
/* Clear the interrupt mask */
i_InterruptMask = 0;
 
-   /* Read the board interrupt status */
-   status = inl(devpriv->amcc + AMCC_OP_REG_INTCSR);
-
-   /* Test if board generated a interrupt */
-   if (status & INTCSR_INTR_ASSERTED) {
-   /* Disable all Interrupt */
-   /* Selects the master interrupt control register */
-   /* Disables  the main interrupt on the board */
-   i_RegValue = z8536_read(dev,
-   APCI1500_RW_PORT_A_COMMAND_AND_STATUS);
-   if ((i_RegValue & 0x60) == 0x60) {
-   /* Deletes the interrupt of port A */
-   i_RegValue = (i_RegValue & 0x0F) | 0x20;
-   z8536_write(dev, i_RegValue,
-   APCI1500_RW_PORT_A_COMMAND_AND_STATUS);
-   i_InterruptMask = i_InterruptMask | 1;
-   if (i_Logic == APCI1500_OR_PRIORITY) {
-   i_RegValue = z8536_read(dev,
-   APCI1500_RW_PORT_A_SPECIFICATION);
+   val = inl(devpriv->amcc + AMCC_OP_REG_INTCSR);
+   if (!(val & INTCSR_INTR_ASSERTED))
+   return IRQ_NONE;
 
-   i_RegValue = z8536_read(dev,
-   APCI1500_RW_PORT_A_INTERRUPT_CONTROL);
+   /* Disable all Interrupt */
+   /* Selects the master interrupt control register */
+   /* Disables  the main interrupt on the board */
+   val = z8536_read(dev, APCI1500_RW_PORT_A_COMMAND_AND_STATUS);
+   if ((val & 0x60) == 0x60) {
+   /* Deletes the interrupt of port A */
+   val &= 0x0f;
+   val |= 0x20;
+   z8536_write(dev, val, APCI1500_RW_PORT_A_COMMAND_AND_STATUS);
+   i_InterruptMask = i_InterruptMask | 1;
+   if (i_Logic == APCI1500_OR_PRIORITY) {
+   val = z8536_read(dev, APCI1500_RW_PORT_A_SPECIFICATION);
 
-   i_InputChannel = 1 + (i_RegValue >> 1);
+   val = z8536_read(dev,
+APCI1500_RW_PORT_A_INTERRUPT_CONTROL);
 
-   } else {
-   i_InputChannel = 0;
-   }
-   }
-
-   i_RegValue = z8536_read(dev,
-   APCI1500_RW_PORT_B_COMMAND_AND_STATUS);
-   if ((i_RegValue & 0x60) == 0x60) {
-   /* Deletes the interrupt of port B */
-   i_RegValue = (i_RegValue & 0x0F) | 0x20;
-   z8536_write(dev, i_RegValue,
-   APCI1500_RW_PORT_B_COMMAND_AND_STATUS);
-   /* Reads port B */
-   i_RegValue = inb(dev->iobase +
-APCI1500_Z8536_PORTB_REG);
-
-   i_RegValue = i_RegValue & 0xC0;
-   /* Tests if this is an external error */
-
-   if (i_RegValue) {
-   /* Disable the interrupt */
-   /* Selects the command and status register of 
port B */
-   outl(0x0, devpriv->amcc + AMCC_OP_REG_INTCSR);
-
-   if (i_RegValue & 0x80) {
-   i_InterruptMask =
-   i_InterruptMask | 0x40;
-   }
+   i_InputChannel = 1 + (val >> 1);
 
-   if (i_RegValue & 0x40) {
-   i_InterruptMask =
-   i_InterruptMask | 0x80;
-   }
-   } else {
-   i_InterruptMask = i_InterruptMask | 2;
-  

[PATCH v2 08/11] staging: comedi: addi_apci_1500: rename private data 'i_IobaseAddon'

2014-12-03 Thread H Hartley Sweeten
Rename this CamelCase member of the private data.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 .../comedi/drivers/addi-data/hwdrv_apci1500.c| 20 
 drivers/staging/comedi/drivers/addi_apci_1500.c  |  4 ++--
 2 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c 
b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
index ac51181..7eb7d9e 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
@@ -600,7 +600,7 @@ static int apci1500_di_insn_bits(struct comedi_device *dev,
 {
struct apci1500_private *devpriv = dev->private;
 
-   data[1] = inw(devpriv->i_IobaseAddon + APCI1500_DIGITAL_IP);
+   data[1] = inw(devpriv->addon + APCI1500_DIGITAL_IP);
 
return insn->n;
 }
@@ -641,8 +641,7 @@ static int apci1500_do_write(struct comedi_device *dev,
if (data[3] == 0) {
if (data[1] == 0) {
data[0] = (data[0] << ui_NoOfChannel) | ui_Temp;
-   outw(data[0],
-   devpriv->i_IobaseAddon + APCI1500_DIGITAL_OP);
+   outw(data[0], devpriv->addon + APCI1500_DIGITAL_OP);
} else {
if (data[1] == 1) {
switch (ui_NoOfChannel) {
@@ -677,8 +676,7 @@ static int apci1500_do_write(struct comedi_device *dev,
}
 
outw(data[0],
-   devpriv->i_IobaseAddon +
-   APCI1500_DIGITAL_OP);
+devpriv->addon + APCI1500_DIGITAL_OP);
} else {
dev_warn(dev->class_dev,
"Specified channel not supported\n");
@@ -697,8 +695,7 @@ static int apci1500_do_write(struct comedi_device *dev,
0x;
data[0] = data[0] & ui_Temp;
outw(data[0],
-   devpriv->i_IobaseAddon +
-   APCI1500_DIGITAL_OP);
+devpriv->addon + APCI1500_DIGITAL_OP);
} else {
if (data[1] == 1) {
switch (ui_NoOfChannel) {
@@ -752,9 +749,8 @@ static int apci1500_do_write(struct comedi_device *dev,
 
}
 
-   outw(data[0],
-   devpriv->i_IobaseAddon +
-   APCI1500_DIGITAL_OP);
+   outw(data[0], devpriv->addon +
+APCI1500_DIGITAL_OP);
} else {
dev_warn(dev->class_dev,
"Specified channel not 
supported\n");
@@ -797,7 +793,7 @@ static int apci1500_timer_config(struct comedi_device *dev,
 
/* Selection of the input clock */
if (data[0] == 0 || data[0] == 1 || data[0] == 2) {
-   outw(data[0], devpriv->i_IobaseAddon + APCI1500_CLK_SELECT);
+   outw(data[0], devpriv->addon + APCI1500_CLK_SELECT);
} else {
if (data[0] != 3) {
dev_warn(dev->class_dev,
@@ -1629,7 +1625,7 @@ static int apci1500_reset(struct comedi_device *dev)
z8536_reset(dev);
 
/* reset all the digital outputs */
-   outw(0x0, devpriv->i_IobaseAddon + APCI1500_DIGITAL_OP);
+   outw(0x0, devpriv->addon + APCI1500_DIGITAL_OP);
 
/* Deactivates all interrupts */
z8536_write(dev, 0x00, APCI1500_RW_MASTER_INTERRUPT_CONTROL);
diff --git a/drivers/staging/comedi/drivers/addi_apci_1500.c 
b/drivers/staging/comedi/drivers/addi_apci_1500.c
index 9571d50..9cb80e0 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1500.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1500.c
@@ -22,7 +22,7 @@
 
 struct apci1500_private {
unsigned long amcc;
-   int i_IobaseAddon;
+   unsigned long addon;
unsigned char b_OutputMemoryStatus;
struct task_struct *tsk_Current;
 };
@@ -47,7 +47,7 @@ static int apci1500_auto_attach(struct comedi_device *dev,
 
dev->iobase = pci_resource_start(pcidev, 1);
devpriv->amcc = pci_resource_start(pcidev, 0);
-   devpriv->i_IobaseAddon = pci_resource_start(pcidev, 2);
+   devpriv->addon = pci_resource_start(pcidev, 2);
 
if (pcidev->irq > 0) {
ret = request_irq(pcidev->irq, apci1500_interrupt, IRQF_SHARED,
-- 
2.0.3

___
devel mailing li

[PATCH v2 10/11] staging: comedi: addi_apci_1500: remove APCI1500_ADDRESS_RANGE

2014-12-03 Thread H Hartley Sweeten
This define is not used by the driver. Remove it.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c 
b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
index a888768..35281fb 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
@@ -21,9 +21,6 @@
  *
  */
 
-/* Card Specific information */
-#define APCI1500_ADDRESS_RANGE 4
-
 /* DIGITAL INPUT-OUTPUT DEFINE */
 
 #define APCI1500_AND   2
-- 
2.0.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 09/11] staging: comedi: addi_apci_1500: tidy up PCI Bar 2 register map

2014-12-03 Thread H Hartley Sweeten
Move the PCI Bar 1 register map defines to the main driver source file.
For aesthetics, rename the defines.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 .../comedi/drivers/addi-data/hwdrv_apci1500.c   | 21 -
 drivers/staging/comedi/drivers/addi_apci_1500.c |  7 +++
 2 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c 
b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
index 7eb7d9e..a888768 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
@@ -26,12 +26,9 @@
 
 /* DIGITAL INPUT-OUTPUT DEFINE */
 
-#define APCI1500_DIGITAL_OP2
-#define APCI1500_DIGITAL_IP0
 #define APCI1500_AND   2
 #define APCI1500_OR4
 #define APCI1500_OR_PRIORITY   6
-#define APCI1500_CLK_SELECT0
 #define COUNTER1   0
 #define COUNTER2   1
 #define COUNTER3   2
@@ -600,7 +597,7 @@ static int apci1500_di_insn_bits(struct comedi_device *dev,
 {
struct apci1500_private *devpriv = dev->private;
 
-   data[1] = inw(devpriv->addon + APCI1500_DIGITAL_IP);
+   data[1] = inw(devpriv->addon + APCI1500_DI_REG);
 
return insn->n;
 }
@@ -641,7 +638,7 @@ static int apci1500_do_write(struct comedi_device *dev,
if (data[3] == 0) {
if (data[1] == 0) {
data[0] = (data[0] << ui_NoOfChannel) | ui_Temp;
-   outw(data[0], devpriv->addon + APCI1500_DIGITAL_OP);
+   outw(data[0], devpriv->addon + APCI1500_DO_REG);
} else {
if (data[1] == 1) {
switch (ui_NoOfChannel) {
@@ -675,8 +672,7 @@ static int apci1500_do_write(struct comedi_device *dev,
 
}
 
-   outw(data[0],
-devpriv->addon + APCI1500_DIGITAL_OP);
+   outw(data[0], devpriv->addon + APCI1500_DO_REG);
} else {
dev_warn(dev->class_dev,
"Specified channel not supported\n");
@@ -694,8 +690,7 @@ static int apci1500_do_write(struct comedi_device *dev,
(data[0] << ui_NoOfChannel) ^
0x;
data[0] = data[0] & ui_Temp;
-   outw(data[0],
-devpriv->addon + APCI1500_DIGITAL_OP);
+   outw(data[0], devpriv->addon + APCI1500_DO_REG);
} else {
if (data[1] == 1) {
switch (ui_NoOfChannel) {
@@ -749,8 +744,8 @@ static int apci1500_do_write(struct comedi_device *dev,
 
}
 
-   outw(data[0], devpriv->addon +
-APCI1500_DIGITAL_OP);
+   outw(data[0],
+devpriv->addon + APCI1500_DO_REG);
} else {
dev_warn(dev->class_dev,
"Specified channel not 
supported\n");
@@ -793,7 +788,7 @@ static int apci1500_timer_config(struct comedi_device *dev,
 
/* Selection of the input clock */
if (data[0] == 0 || data[0] == 1 || data[0] == 2) {
-   outw(data[0], devpriv->addon + APCI1500_CLK_SELECT);
+   outw(data[0], devpriv->addon + APCI1500_CLK_SEL_REG);
} else {
if (data[0] != 3) {
dev_warn(dev->class_dev,
@@ -1625,7 +1620,7 @@ static int apci1500_reset(struct comedi_device *dev)
z8536_reset(dev);
 
/* reset all the digital outputs */
-   outw(0x0, devpriv->addon + APCI1500_DIGITAL_OP);
+   outw(0x0, devpriv->addon + APCI1500_DO_REG);
 
/* Deactivates all interrupts */
z8536_write(dev, 0x00, APCI1500_RW_MASTER_INTERRUPT_CONTROL);
diff --git a/drivers/staging/comedi/drivers/addi_apci_1500.c 
b/drivers/staging/comedi/drivers/addi_apci_1500.c
index 9cb80e0..6892c0a 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1500.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1500.c
@@ -20,6 +20,13 @@
 #define APCI1500_Z8536_PORTA_REG   0x02
 #define APCI1500_Z8536_CTRL_REG0x03
 
+/*
+ * PCI Bar 2 Register map (devpriv->addon)
+ */
+#define APCI1500_CLK_SEL_REG   0x00
+#define APCI1500_DI_REG0x00
+#define APCI1500_DO_REG0x02
+
 struct apci1500_private {
unsigned long amc

[PATCH v2 02/11] staging: comedi: hwdrv_apci1500: introduce z8536_write()

2014-12-03 Thread H Hartley Sweeten
The Z8536 CIO registers are indirectly written by writing the register offset
to the control register then writing the value to the control register.

Introduce a helper function to write the Z8536 CIO registers.

The registers are written from "normal" code and in the interrupt handler,
spinlock the sequence to protect the indirect register access.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 .../comedi/drivers/addi-data/hwdrv_apci1500.c  | 1059 +---
 1 file changed, 250 insertions(+), 809 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c 
b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
index 594f132..248fae5 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
@@ -143,6 +143,18 @@ static unsigned int z8536_read(struct comedi_device *dev, 
unsigned int reg)
return val;
 }
 
+static void z8536_write(struct comedi_device *dev,
+   unsigned int val, unsigned int reg)
+{
+   struct apci1500_private *devpriv = dev->private;
+   unsigned long flags;
+
+   spin_lock_irqsave(&dev->spinlock, flags);
+   outb(reg, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
+   outb(val, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
+   spin_unlock_irqrestore(&dev->spinlock, flags);
+}
+
 /*
  * An event can be generated for each port. The first event is related to the
  * first 8 channels (port 1) and the second to the following 6 channels (port 
2)
@@ -172,17 +184,13 @@ static int apci1500_di_config(struct comedi_device *dev,
  struct comedi_insn *insn,
  unsigned int *data)
 {
-   struct apci1500_private *devpriv = dev->private;
int i_PatternPolarity = 0, i_PatternTransition = 0, i_PatternMask = 0;
int i_MaxChannel = 0, i_Count = 0, i_EventMask = 0;
int i_PatternTransitionCount = 0, i_RegValue;
int i;
 
-   /* Selects the master interrupt control register */
-   outb(APCI1500_RW_MASTER_INTERRUPT_CONTROL,
-   devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
-   /* Disables  the main interrupt on the board */
-   outb(0x00, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
+   /* Disables the main interrupt on the board */
+   z8536_write(dev, 0x00, APCI1500_RW_MASTER_INTERRUPT_CONTROL);
 
if (data[0] == 1) {
i_MaxChannel = 8;
@@ -292,67 +300,29 @@ static int apci1500_di_config(struct comedi_device *dev,
}
}
 
-   /* Selects the APCI1500_RW_MASTER_CONFIGURATION_CONTROL 
register */
-   outb(APCI1500_RW_MASTER_CONFIGURATION_CONTROL,
-   devpriv->iobase +
-   APCI1500_Z8536_CONTROL_REGISTER);
/* Disable Port A */
-   outb(0xF0,
-   devpriv->iobase +
-   APCI1500_Z8536_CONTROL_REGISTER);
-   /* Selects the polarity register of port 1*/
-   outb(APCI1500_RW_PORT_A_PATTERN_POLARITY,
-   devpriv->iobase +
-   APCI1500_Z8536_CONTROL_REGISTER);
-   outb(i_PatternPolarity,
-   devpriv->iobase +
-   APCI1500_Z8536_CONTROL_REGISTER);
-
-   /* Selects the pattern mask register of  */
-   /* port 1*/
-   outb(APCI1500_RW_PORT_A_PATTERN_MASK,
-   devpriv->iobase +
-   APCI1500_Z8536_CONTROL_REGISTER);
-   outb(i_PatternMask,
-   devpriv->iobase +
-   APCI1500_Z8536_CONTROL_REGISTER);
-   /* Selects the pattern transition register  */
-   /* of port 1*/
-   outb(APCI1500_RW_PORT_A_PATTERN_TRANSITION,
-   devpriv->iobase +
-   APCI1500_Z8536_CONTROL_REGISTER);
-   outb(i_PatternTransition,
-   devpriv->iobase +
-   APCI1500_Z8536_CONTROL_REGISTER);
-
-   i_RegValue = z8536_read(dev,
-   APCI1500_RW_PORT_A_SPECIFICATION);
+   z8536_write(dev, 0xf0,
+   APCI1500_RW_MASTER_CONFIGURATION_CONTROL);
 
-   /* Selects the mode specification mask*/
-   /* register of port 1 */
-   outb(APCI1500_RW_POR

[PATCH v2 05/11] staging: comedi: addi_apci_1500: remove private data 'iobase'

2014-12-03 Thread H Hartley Sweeten
This member of the private data is the same as the comedi_device 'iobase'.
Remove the private data member and use that instead.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 .../comedi/drivers/addi-data/hwdrv_apci1500.c  | 25 ++
 drivers/staging/comedi/drivers/addi_apci_1500.c|  4 +---
 2 files changed, 12 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c 
b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
index d5d959c..ea6d98f 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
@@ -121,13 +121,12 @@ static int i_TimerCounter1Enabled, i_TimerCounter2Enabled,
 
 static unsigned int z8536_read(struct comedi_device *dev, unsigned int reg)
 {
-   struct apci1500_private *devpriv = dev->private;
unsigned long flags;
unsigned int val;
 
spin_lock_irqsave(&dev->spinlock, flags);
-   outb(reg, devpriv->iobase + APCI1500_Z8536_CTRL_REG);
-   val = inb(devpriv->iobase + APCI1500_Z8536_CTRL_REG);
+   outb(reg, dev->iobase + APCI1500_Z8536_CTRL_REG);
+   val = inb(dev->iobase + APCI1500_Z8536_CTRL_REG);
spin_unlock_irqrestore(&dev->spinlock, flags);
 
return val;
@@ -136,18 +135,16 @@ static unsigned int z8536_read(struct comedi_device *dev, 
unsigned int reg)
 static void z8536_write(struct comedi_device *dev,
unsigned int val, unsigned int reg)
 {
-   struct apci1500_private *devpriv = dev->private;
unsigned long flags;
 
spin_lock_irqsave(&dev->spinlock, flags);
-   outb(reg, devpriv->iobase + APCI1500_Z8536_CTRL_REG);
-   outb(val, devpriv->iobase + APCI1500_Z8536_CTRL_REG);
+   outb(reg, dev->iobase + APCI1500_Z8536_CTRL_REG);
+   outb(val, dev->iobase + APCI1500_Z8536_CTRL_REG);
spin_unlock_irqrestore(&dev->spinlock, flags);
 }
 
 static void z8536_reset(struct comedi_device *dev)
 {
-   struct apci1500_private *devpriv = dev->private;
unsigned long flags;
 
/*
@@ -155,12 +152,12 @@ static void z8536_reset(struct comedi_device *dev)
 * sequence will reset it and put it in State 0.
 */
spin_lock_irqsave(&dev->spinlock, flags);
-   inb(devpriv->iobase + APCI1500_Z8536_CTRL_REG);
-   outb(0, devpriv->iobase + APCI1500_Z8536_CTRL_REG);
-   inb(devpriv->iobase + APCI1500_Z8536_CTRL_REG);
-   outb(0, devpriv->iobase + APCI1500_Z8536_CTRL_REG);
-   outb(1, devpriv->iobase + APCI1500_Z8536_CTRL_REG);
-   outb(0, devpriv->iobase + APCI1500_Z8536_CTRL_REG);
+   inb(dev->iobase + APCI1500_Z8536_CTRL_REG);
+   outb(0, dev->iobase + APCI1500_Z8536_CTRL_REG);
+   inb(dev->iobase + APCI1500_Z8536_CTRL_REG);
+   outb(0, dev->iobase + APCI1500_Z8536_CTRL_REG);
+   outb(1, dev->iobase + APCI1500_Z8536_CTRL_REG);
+   outb(0, dev->iobase + APCI1500_Z8536_CTRL_REG);
spin_unlock_irqrestore(&dev->spinlock, flags);
 
z8536_write(dev, 0xf4, APCI1500_RW_MASTER_CONFIGURATION_CONTROL);
@@ -1541,7 +1538,7 @@ static irqreturn_t apci1500_interrupt(int irq, void *d)
z8536_write(dev, i_RegValue,
APCI1500_RW_PORT_B_COMMAND_AND_STATUS);
/* Reads port B */
-   i_RegValue = inb(devpriv->iobase +
+   i_RegValue = inb(dev->iobase +
 APCI1500_Z8536_PORTB_REG);
 
i_RegValue = i_RegValue & 0xC0;
diff --git a/drivers/staging/comedi/drivers/addi_apci_1500.c 
b/drivers/staging/comedi/drivers/addi_apci_1500.c
index 52df495..d8a6170 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1500.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1500.c
@@ -8,7 +8,7 @@
 #include "amcc_s5933.h"
 
 /*
- * PCI Bar 1 Register map (devpriv->iobase)
+ * PCI Bar 1 Register map (dev->iobase)
  */
 #define APCI1500_Z8536_PORTC_REG   0x00
 #define APCI1500_Z8536_PORTB_REG   0x01
@@ -16,7 +16,6 @@
 #define APCI1500_Z8536_CTRL_REG0x03
 
 struct apci1500_private {
-   int iobase;
int i_IobaseAmcc;
int i_IobaseAddon;
int i_IobaseReserved;
@@ -43,7 +42,6 @@ static int apci1500_auto_attach(struct comedi_device *dev,
return ret;
 
dev->iobase = pci_resource_start(pcidev, 1);
-   devpriv->iobase = dev->iobase;
devpriv->i_IobaseAmcc = pci_resource_start(pcidev, 0);
devpriv->i_IobaseAddon = pci_resource_start(pcidev, 2);
devpriv->i_IobaseReserved = pci_resource_start(pcidev, 3);
-- 
2.0.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 06/11] staging: comedi: addi_apci_1500: remove private data 'i_IobaseReserved'

2014-12-03 Thread H Hartley Sweeten
This member of the private data is set but not used by the driver.
Remove it.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/addi_apci_1500.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi_apci_1500.c 
b/drivers/staging/comedi/drivers/addi_apci_1500.c
index d8a6170..4b2e3fb 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1500.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1500.c
@@ -18,7 +18,6 @@
 struct apci1500_private {
int i_IobaseAmcc;
int i_IobaseAddon;
-   int i_IobaseReserved;
unsigned char b_OutputMemoryStatus;
struct task_struct *tsk_Current;
 };
@@ -44,7 +43,6 @@ static int apci1500_auto_attach(struct comedi_device *dev,
dev->iobase = pci_resource_start(pcidev, 1);
devpriv->i_IobaseAmcc = pci_resource_start(pcidev, 0);
devpriv->i_IobaseAddon = pci_resource_start(pcidev, 2);
-   devpriv->i_IobaseReserved = pci_resource_start(pcidev, 3);
 
if (pcidev->irq > 0) {
ret = request_irq(pcidev->irq, apci1500_interrupt, IRQF_SHARED,
-- 
2.0.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 07/11] staging: comedi: addi_apci_1500: use amcc_s5933.h defines

2014-12-03 Thread H Hartley Sweeten
PCI Bar 0 accesses the AMCC S5933 PCI controller used on this board.
Use the defines from amcc_35933.h and remove the "magic" numbers.

Rename the CamelCase private data member 'i_IobaseAmcc' used to hold
the address for PCI Bar 0.

Remove the unnecessary 'ui_Status' local variable in apci1500_do_bits()
that is used to hold the result of some dummy reads. Rename the
CamelCase local variable 'ui_InterruptStatus' that is used to check the
interrupt from the amcc chip.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 .../comedi/drivers/addi-data/hwdrv_apci1500.c   | 21 +++--
 drivers/staging/comedi/drivers/addi_apci_1500.c |  9 +++--
 2 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c 
b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
index ea6d98f..ac51181 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
@@ -1422,12 +1422,11 @@ static int apci1500_do_bits(struct comedi_device *dev,
unsigned int *data)
 {
struct apci1500_private *devpriv = dev->private;
-   unsigned int ui_Status;
int i_RegValue;
int i_Constant;
 
devpriv->tsk_Current = current;
-   outl(0x0, devpriv->i_IobaseAmcc + 0x38);
+   outl(0x0, devpriv->amcc + AMCC_OP_REG_INTCSR);
if (data[0] == 1) {
i_Constant = 0xC0;
} else {
@@ -1481,10 +1480,12 @@ static int apci1500_do_bits(struct comedi_device *dev,
z8536_write(dev, 0xd0, APCI1500_RW_MASTER_INTERRUPT_CONTROL);
 
/* Enables the PCI interrupt */
-   outl(0x3000, devpriv->i_IobaseAmcc + 0x38);
-   ui_Status = inl(devpriv->i_IobaseAmcc + 0x10);
-   ui_Status = inl(devpriv->i_IobaseAmcc + 0x38);
-   outl(0x23000, devpriv->i_IobaseAmcc + 0x38);
+   outl(0x2000 | INTCSR_INBOX_FULL_INT,
+devpriv->amcc + AMCC_OP_REG_INTCSR);
+   inl(devpriv->amcc + AMCC_OP_REG_IMB1);
+   inl(devpriv->amcc + AMCC_OP_REG_INTCSR);
+   outl(INTCSR_INBOX_INTR_STATUS | 0x2000 | INTCSR_INBOX_FULL_INT,
+devpriv->amcc + AMCC_OP_REG_INTCSR);
 
return insn->n;
 }
@@ -1494,17 +1495,17 @@ static irqreturn_t apci1500_interrupt(int irq, void *d)
 
struct comedi_device *dev = d;
struct apci1500_private *devpriv = dev->private;
-   unsigned int ui_InterruptStatus = 0;
+   unsigned int status;
int i_RegValue = 0;
 
/* Clear the interrupt mask */
i_InterruptMask = 0;
 
/* Read the board interrupt status */
-   ui_InterruptStatus = inl(devpriv->i_IobaseAmcc + 0x38);
+   status = inl(devpriv->amcc + AMCC_OP_REG_INTCSR);
 
/* Test if board generated a interrupt */
-   if ((ui_InterruptStatus & 0x80) == 0x80) {
+   if (status & INTCSR_INTR_ASSERTED) {
/* Disable all Interrupt */
/* Selects the master interrupt control register */
/* Disables  the main interrupt on the board */
@@ -1547,7 +1548,7 @@ static irqreturn_t apci1500_interrupt(int irq, void *d)
if (i_RegValue) {
/* Disable the interrupt */
/* Selects the command and status register of 
port B */
-   outl(0x0, devpriv->i_IobaseAmcc + 0x38);
+   outl(0x0, devpriv->amcc + AMCC_OP_REG_INTCSR);
 
if (i_RegValue & 0x80) {
i_InterruptMask =
diff --git a/drivers/staging/comedi/drivers/addi_apci_1500.c 
b/drivers/staging/comedi/drivers/addi_apci_1500.c
index 4b2e3fb..9571d50 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1500.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1500.c
@@ -8,6 +8,11 @@
 #include "amcc_s5933.h"
 
 /*
+ * PCI Bar 0 Register map (devpriv->amcc)
+ * see amcc_s5933.h for register and bit defines
+ */
+
+/*
  * PCI Bar 1 Register map (dev->iobase)
  */
 #define APCI1500_Z8536_PORTC_REG   0x00
@@ -16,7 +21,7 @@
 #define APCI1500_Z8536_CTRL_REG0x03
 
 struct apci1500_private {
-   int i_IobaseAmcc;
+   unsigned long amcc;
int i_IobaseAddon;
unsigned char b_OutputMemoryStatus;
struct task_struct *tsk_Current;
@@ -41,7 +46,7 @@ static int apci1500_auto_attach(struct comedi_device *dev,
return ret;
 
dev->iobase = pci_resource_start(pcidev, 1);
-   devpriv->i_IobaseAmcc = pci_resource_start(pcidev, 0);
+   devpriv->amcc = pci_resource_start(pcidev, 0);
devpriv->i_IobaseAddon = pci_resource_start(pcidev, 2);
 
if (pcidev->irq > 0) {
-- 
2.0.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 04/11] staging: comedi: addi_apci_1500: tidy up PCI Bar 1 register map

2014-12-03 Thread H Hartley Sweeten
For aesthetics, convert the enum for the PCI Bar 1 register map to
defines and move them to the main driver source file. Rename the
registers.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 .../comedi/drivers/addi-data/hwdrv_apci1500.c  | 35 --
 drivers/staging/comedi/drivers/addi_apci_1500.c|  8 +
 2 files changed, 20 insertions(+), 23 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c 
b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
index 26b46c5..d5d959c 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
@@ -51,16 +51,6 @@
 #define TRIGGER2
 
 /*
- * Zillog I/O enumeration
- */
-enum {
-   APCI1500_Z8536_PORT_C,
-   APCI1500_Z8536_PORT_B,
-   APCI1500_Z8536_PORT_A,
-   APCI1500_Z8536_CONTROL_REGISTER
-};
-
-/*
  * Z8536 CIO Internal Address
  */
 enum {
@@ -136,8 +126,8 @@ static unsigned int z8536_read(struct comedi_device *dev, 
unsigned int reg)
unsigned int val;
 
spin_lock_irqsave(&dev->spinlock, flags);
-   outb(reg, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
-   val = inb(devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
+   outb(reg, devpriv->iobase + APCI1500_Z8536_CTRL_REG);
+   val = inb(devpriv->iobase + APCI1500_Z8536_CTRL_REG);
spin_unlock_irqrestore(&dev->spinlock, flags);
 
return val;
@@ -150,8 +140,8 @@ static void z8536_write(struct comedi_device *dev,
unsigned long flags;
 
spin_lock_irqsave(&dev->spinlock, flags);
-   outb(reg, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
-   outb(val, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
+   outb(reg, devpriv->iobase + APCI1500_Z8536_CTRL_REG);
+   outb(val, devpriv->iobase + APCI1500_Z8536_CTRL_REG);
spin_unlock_irqrestore(&dev->spinlock, flags);
 }
 
@@ -165,12 +155,12 @@ static void z8536_reset(struct comedi_device *dev)
 * sequence will reset it and put it in State 0.
 */
spin_lock_irqsave(&dev->spinlock, flags);
-   inb(devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
-   outb(0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
-   inb(devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
-   outb(0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
-   outb(1, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
-   outb(0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
+   inb(devpriv->iobase + APCI1500_Z8536_CTRL_REG);
+   outb(0, devpriv->iobase + APCI1500_Z8536_CTRL_REG);
+   inb(devpriv->iobase + APCI1500_Z8536_CTRL_REG);
+   outb(0, devpriv->iobase + APCI1500_Z8536_CTRL_REG);
+   outb(1, devpriv->iobase + APCI1500_Z8536_CTRL_REG);
+   outb(0, devpriv->iobase + APCI1500_Z8536_CTRL_REG);
spin_unlock_irqrestore(&dev->spinlock, flags);
 
z8536_write(dev, 0xf4, APCI1500_RW_MASTER_CONFIGURATION_CONTROL);
@@ -1551,9 +1541,8 @@ static irqreturn_t apci1500_interrupt(int irq, void *d)
z8536_write(dev, i_RegValue,
APCI1500_RW_PORT_B_COMMAND_AND_STATUS);
/* Reads port B */
-   i_RegValue =
-   inb((unsigned int) devpriv->iobase +
-   APCI1500_Z8536_PORT_B);
+   i_RegValue = inb(devpriv->iobase +
+APCI1500_Z8536_PORTB_REG);
 
i_RegValue = i_RegValue & 0xC0;
/* Tests if this is an external error */
diff --git a/drivers/staging/comedi/drivers/addi_apci_1500.c 
b/drivers/staging/comedi/drivers/addi_apci_1500.c
index 30b132c..52df495 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1500.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1500.c
@@ -7,6 +7,14 @@
 #include "comedi_fc.h"
 #include "amcc_s5933.h"
 
+/*
+ * PCI Bar 1 Register map (devpriv->iobase)
+ */
+#define APCI1500_Z8536_PORTC_REG   0x00
+#define APCI1500_Z8536_PORTB_REG   0x01
+#define APCI1500_Z8536_PORTA_REG   0x02
+#define APCI1500_Z8536_CTRL_REG0x03
+
 struct apci1500_private {
int iobase;
int i_IobaseAmcc;
-- 
2.0.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 03/11] staging: comedi: hwdrv_apci1500: introduce z8536_reset()

2014-12-03 Thread H Hartley Sweeten
Introduce a helper function to reset the Z8536 CIO device.

Spinlock the initial reset of the Z8536 chip that puts it in State 0.
The z8536_{read,write} operations already do the spinlock to protect
the indirect register access.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 .../comedi/drivers/addi-data/hwdrv_apci1500.c  | 188 -
 1 file changed, 72 insertions(+), 116 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c 
b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
index 248fae5..26b46c5 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
@@ -155,6 +155,76 @@ static void z8536_write(struct comedi_device *dev,
spin_unlock_irqrestore(&dev->spinlock, flags);
 }
 
+static void z8536_reset(struct comedi_device *dev)
+{
+   struct apci1500_private *devpriv = dev->private;
+   unsigned long flags;
+
+   /*
+* Even if the state of the Z8536 is not known, the following
+* sequence will reset it and put it in State 0.
+*/
+   spin_lock_irqsave(&dev->spinlock, flags);
+   inb(devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
+   outb(0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
+   inb(devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
+   outb(0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
+   outb(1, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
+   outb(0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
+   spin_unlock_irqrestore(&dev->spinlock, flags);
+
+   z8536_write(dev, 0xf4, APCI1500_RW_MASTER_CONFIGURATION_CONTROL);
+
+   z8536_write(dev, 0x10, APCI1500_RW_PORT_A_SPECIFICATION);
+   /* High level of port A means 1 */
+   z8536_write(dev, 0xff, APCI1500_RW_PORT_A_DATA_PCITCH_POLARITY);
+   /* All bits used as inputs */
+   z8536_write(dev, 0xff, APCI1500_RW_PORT_A_DATA_DIRECTION);
+   /* Deletes IP and IUS */
+   z8536_write(dev, 0x20, APCI1500_RW_PORT_A_COMMAND_AND_STATUS);
+   /* Deactivates the interrupt management of port A */
+   z8536_write(dev, 0xe0, APCI1500_RW_PORT_A_COMMAND_AND_STATUS);
+   /* Deletes the register */
+   z8536_write(dev, 0x00, APCI1500_RW_PORT_A_HANDSHAKE_SPECIFICATION);
+
+   z8536_write(dev, 0x10, APCI1500_RW_PORT_B_SPECIFICATION);
+   /* A high level of port B means 1 */
+   z8536_write(dev, 0x7f, APCI1500_RW_PORT_B_DATA_PCITCH_POLARITY);
+   /* All bits used as inputs */
+   z8536_write(dev, 0xff, APCI1500_RW_PORT_B_DATA_DIRECTION);
+   /* Deletes IP and IUS */
+   z8536_write(dev, 0x20, APCI1500_RW_PORT_B_COMMAND_AND_STATUS);
+   /* Deactivates the interrupt management of port B */
+   z8536_write(dev, 0xe0, APCI1500_RW_PORT_B_COMMAND_AND_STATUS);
+   /* Deletes the register */
+   z8536_write(dev, 0x00, APCI1500_RW_PORT_B_HANDSHAKE_SPECIFICATION);
+
+   /* High level of port C means 1 */
+   z8536_write(dev, 0x09, APCI1500_RW_PORT_C_DATA_PCITCH_POLARITY);
+   /* All bits used as inputs except channel 1 */
+   z8536_write(dev, 0x0e, APCI1500_RW_PORT_C_DATA_DIRECTION);
+   /* Deletes it */
+   z8536_write(dev, 0x00, APCI1500_RW_PORT_C_SPECIAL_IO_CONTROL);
+
+   /* Deletes IP and IUS */
+   z8536_write(dev, 0x20, APCI1500_RW_CPT_TMR1_CMD_STATUS);
+   /* Deactivates the interrupt management of timer 1 */
+   z8536_write(dev, 0xe0, APCI1500_RW_CPT_TMR1_CMD_STATUS);
+
+   /* Deletes IP and IUS */
+   z8536_write(dev, 0x20, APCI1500_RW_CPT_TMR2_CMD_STATUS);
+   /* Deactivates Timer 2 interrupt management */
+   z8536_write(dev, 0xe0, APCI1500_RW_CPT_TMR2_CMD_STATUS);
+
+   /* Deletes IP and IUS */
+   z8536_write(dev, 0x20, APCI1500_RW_CPT_TMR3_CMD_STATUS);
+   /* Deactivates interrupt management of timer 3 */
+   z8536_write(dev, 0xe0, APCI1500_RW_CPT_TMR3_CMD_STATUS);
+
+   /* Deletes all interrupts */
+   z8536_write(dev, 0x00, APCI1500_RW_MASTER_INTERRUPT_CONTROL);
+}
+
 /*
  * An event can be generated for each port. The first event is related to the
  * first 8 channels (port 1) and the second to the following 6 channels (port 
2)
@@ -530,65 +600,8 @@ static int apci1500_di_read(struct comedi_device *dev,
struct comedi_insn *insn,
unsigned int *data)
 {
-   struct apci1500_private *devpriv = dev->private;
-   int i_DummyRead = 0;
-
/* Software reset */
-   i_DummyRead = inb(devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
-   outb(0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
-   i_DummyRead = inb(devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
-   outb(0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
-   outb(1, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
-   outb(0, devpriv->iobase + APCI1500_Z

[PATCH v2 00/11] staging: comedi: addi_apci_1500: initial cleanup

2014-12-03 Thread H Hartley Sweeten
This driver is pretty broken but in the current state its difficult to
figure out where to fix it.

Introduce a couple helper functions to handle the read/write and reset
of the Z8536 CIO chip. This removes quite a bit of lines of code and
makes the driver a _bit_ easier to follow.

Tidy up the register map defines.

Fix the interrupt handler so that the IRQ is properly shared.

v2: spinlock protect the Z8536 indirect register access as suggested
by Ian Abbott

H Hartley Sweeten (11):
  staging: comedi: hwdrv_apci1500: introduce z8536_read()
  staging: comedi: hwdrv_apci1500: introduce z8536_write()
  staging: comedi: hwdrv_apci1500: introduce z8536_reset()
  staging: comedi: addi_apci_1500: tidy up PCI Bar 1 register map
  staging: comedi: addi_apci_1500: remove private data 'iobase'
  staging: comedi: addi_apci_1500: remove private data 'i_IobaseReserved'
  staging: comedi: addi_apci_1500: use amcc_s5933.h defines
  staging: comedi: addi_apci_1500: rename private data 'i_IobaseAddon'
  staging: comedi: addi_apci_1500: tidy up PCI Bar 2 register map
  staging: comedi: addi_apci_1500: remove APCI1500_ADDRESS_RANGE
  staging: comedi: addi_apci_1500: handle shared interrupt

 .../comedi/drivers/addi-data/hwdrv_apci1500.c  | 1505 +---
 drivers/staging/comedi/drivers/addi_apci_1500.c|   32 +-
 2 files changed, 404 insertions(+), 1133 deletions(-)

-- 
2.0.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 01/11] staging: comedi: hwdrv_apci1500: introduce z8536_read()

2014-12-03 Thread H Hartley Sweeten
The Z8536 CIO registers are indirectly read by writing the register offset to
the control register then reading the control register to get the value.

Introduce a helper function to read the Z8536 CIO registers.

The registers are read from "normal" code and in the interrupt handler,
spinlock the sequence to protect the indirect register access.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 .../comedi/drivers/addi-data/hwdrv_apci1500.c  | 222 ++---
 1 file changed, 58 insertions(+), 164 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c 
b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
index bfa9228..594f132 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
@@ -129,6 +129,20 @@ static int i_InputChannel;
 static int i_TimerCounter1Enabled, i_TimerCounter2Enabled,
   i_WatchdogCounter3Enabled;
 
+static unsigned int z8536_read(struct comedi_device *dev, unsigned int reg)
+{
+   struct apci1500_private *devpriv = dev->private;
+   unsigned long flags;
+   unsigned int val;
+
+   spin_lock_irqsave(&dev->spinlock, flags);
+   outb(reg, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
+   val = inb(devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
+   spin_unlock_irqrestore(&dev->spinlock, flags);
+
+   return val;
+}
+
 /*
  * An event can be generated for each port. The first event is related to the
  * first 8 channels (port 1) and the second to the following 6 channels (port 
2)
@@ -311,14 +325,8 @@ static int apci1500_di_config(struct comedi_device *dev,
devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER);
 
-   /* Selects the mode specification mask*/
-   /* register of port 1 */
-   outb(APCI1500_RW_PORT_A_SPECIFICATION,
-   devpriv->iobase +
-   APCI1500_Z8536_CONTROL_REGISTER);
-   i_RegValue =
-   inb(devpriv->iobase +
-   APCI1500_Z8536_CONTROL_REGISTER);
+   i_RegValue = z8536_read(dev,
+   APCI1500_RW_PORT_A_SPECIFICATION);
 
/* Selects the mode specification mask*/
/* register of port 1 */
@@ -366,14 +374,8 @@ static int apci1500_di_config(struct comedi_device *dev,
outb(0x74,
devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER);
-   /* Selects the mode specification mask  */
-   /* register of port B   */
-   outb(APCI1500_RW_PORT_B_SPECIFICATION,
-   devpriv->iobase +
-   APCI1500_Z8536_CONTROL_REGISTER);
-   i_RegValue =
-   inb(devpriv->iobase +
-   APCI1500_Z8536_CONTROL_REGISTER);
+   i_RegValue = z8536_read(dev,
+   APCI1500_RW_PORT_B_SPECIFICATION);
 
/* Selects the mode specification mask*/
/* register of port B */
@@ -416,14 +418,8 @@ static int apci1500_di_config(struct comedi_device *dev,
devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER);
 
-   /* Selects the mode specification mask*/
-   /* register of port 2 */
-   outb(APCI1500_RW_PORT_B_SPECIFICATION,
-   devpriv->iobase +
-   APCI1500_Z8536_CONTROL_REGISTER);
-   i_RegValue =
-   inb(devpriv->iobase +
-   APCI1500_Z8536_CONTROL_REGISTER);
+   i_RegValue = z8536_read(dev,
+   APCI1500_RW_PORT_B_SPECIFICATION);
/* Selects the mode specification mask*/
/* register of port 2 */
outb(APCI1500_RW_PORT_B_SPECIFICATION,
@@ -500,12 +496,8 @@ static int apci1500_di_write(struct comedi_device *dev,
devpriv->iobase +

APCI1500_Z8536_CONTROL_REGISTER);
i_Event1InterruptStatus = 1;
-   outb(APCI1500_RW_PORT_A_SPECIFICATION,
-   devpriv->iobase +
-   

Re: [PATCH] Staging: dgnc: Fix long line coding style issues in dgnc_cls.h

2014-12-03 Thread Dan Carpenter
On Wed, Dec 03, 2014 at 09:34:41AM -0800, Greg KH wrote:
> > +#define UART_IIR_CTSRTS0x20/*
> > +*  Received CTS/RTS change of
> > +*  state
> > +*/
> 
> That's pretty ugly, don't you think?  How about putting the comments on
> the line before the #define, instead of at the end?  That would make
> things much nicer to read.
> 

I was going to say the same thing but it looks worse in the mail client
because of how the tabs work out.  In the code it doesn't look terrible.

#define UART_IIR_CTSRTS 0x20/*
 *  Received CTS/RTS change of
 *  state
 */

Another idea would be to just remove a tab.  It wouldn't align with the
section before but it would align with the next section down.

regards,
dan carpenter

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] Staging: dgnc: Fix long line coding style issues in dgnc_cls.h

2014-12-03 Thread Greg KH
On Wed, Dec 03, 2014 at 05:07:28PM +, Sean Cleator wrote:
> A patch to fix the rest of the long line warnings in the dgnc_cls.h file
> found by the checkpatch.pl tool
> 
> Signed-off-by: Sean Cleator 
> 
> ---
>  drivers/staging/dgnc/dgnc_cls.h | 22 +-
>  1 file changed, 17 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/staging/dgnc/dgnc_cls.h b/drivers/staging/dgnc/dgnc_cls.h
> index 465d79a..32034e4 100644
> --- a/drivers/staging/dgnc/dgnc_cls.h
> +++ b/drivers/staging/dgnc/dgnc_cls.h
> @@ -38,7 +38,10 @@
>  struct cls_uart_struct {
>   u8 txrx;/* WR  RHR/THR - Holding Reg */
>   u8 ier; /* WR  IER - Interrupt Enable Reg */
> - u8 isr_fcr; /* WR  ISR/FCR - Interrupt Status Reg/Fifo 
> Control Reg */
> + u8 isr_fcr; /*
> +  * WR  ISR/FCR - Interrupt Status Reg/Fifo
> +  * Control Reg
> +  */
>   u8 lcr; /* WR  LCR - Line Control Reg */
>   u8 mcr; /* WR  MCR - Modem Control Reg */
>   u8 lsr; /* WR  LSR - Line Status Reg */
> @@ -61,8 +64,11 @@ struct cls_uart_struct {
>  #define UART_16654_FCR_RXTRIGGER_56  0x80
>  #define UART_16654_FCR_RXTRIGGER_60 0xC0
>  
> -#define UART_IIR_CTSRTS  0x20/* Received CTS/RTS 
> change of state */
> -#define UART_IIR_RDI_TIMEOUT 0x0C/* Receiver data TIMEOUT */
> +#define UART_IIR_CTSRTS  0x20/*
> +  *  Received CTS/RTS change of
> +  *  state
> +  */

That's pretty ugly, don't you think?  How about putting the comments on
the line before the #define, instead of at the end?  That would make
things much nicer to read.

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Staging: dgnc: Fix long line coding style issues in dgnc_cls.h

2014-12-03 Thread Sean Cleator
A patch to fix the rest of the long line warnings in the dgnc_cls.h file
found by the checkpatch.pl tool

Signed-off-by: Sean Cleator 

---
 drivers/staging/dgnc/dgnc_cls.h | 22 +-
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_cls.h b/drivers/staging/dgnc/dgnc_cls.h
index 465d79a..32034e4 100644
--- a/drivers/staging/dgnc/dgnc_cls.h
+++ b/drivers/staging/dgnc/dgnc_cls.h
@@ -38,7 +38,10 @@
 struct cls_uart_struct {
u8 txrx;/* WR  RHR/THR - Holding Reg */
u8 ier; /* WR  IER - Interrupt Enable Reg */
-   u8 isr_fcr; /* WR  ISR/FCR - Interrupt Status Reg/Fifo 
Control Reg */
+   u8 isr_fcr; /*
+* WR  ISR/FCR - Interrupt Status Reg/Fifo
+* Control Reg
+*/
u8 lcr; /* WR  LCR - Line Control Reg */
u8 mcr; /* WR  MCR - Modem Control Reg */
u8 lsr; /* WR  LSR - Line Status Reg */
@@ -61,8 +64,11 @@ struct cls_uart_struct {
 #define UART_16654_FCR_RXTRIGGER_560x80
 #define UART_16654_FCR_RXTRIGGER_60 0xC0
 
-#define UART_IIR_CTSRTS0x20/* Received CTS/RTS 
change of state */
-#define UART_IIR_RDI_TIMEOUT   0x0C/* Receiver data TIMEOUT */
+#define UART_IIR_CTSRTS0x20/*
+*  Received CTS/RTS change of
+*  state
+*/
+#define UART_IIR_RDI_TIMEOUT   0x0C/* Receiver data TIMEOUT */
 
 /*
  * These are the EXTENDED definitions for the Exar 654's Interrupt
@@ -74,8 +80,14 @@ struct cls_uart_struct {
 #define UART_EXAR654_EFR_RTSDTR   0x40/* Auto RTS/DTR Flow Control Enable 
*/
 #define UART_EXAR654_EFR_CTSDSR   0x80/* Auto CTS/DSR Flow COntrol Enable 
*/
 
-#define UART_EXAR654_XOFF_DETECT  0x1 /* Indicates whether chip saw an 
incoming XOFF char  */
-#define UART_EXAR654_XON_DETECT   0x2 /* Indicates whether chip saw an 
incoming XON char */
+#define UART_EXAR654_XOFF_DETECT  0x1 /*
+  * Indicates whether chip saw an
+  * incoming XOFF char
+  */
+#define UART_EXAR654_XON_DETECT   0x2 /*
+  * Indicates whether chip saw an
+  * incoming XON char
+  */
 
 #define UART_EXAR654_IER_XOFF 0x20/* Xoff Interrupt Enable */
 #define UART_EXAR654_IER_RTSDTR   0x40/* Output Interrupt Enable */
-- 
2.1.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v16 03/12] drm: imx: imx-hdmi: convert imx-hdmi to drm_bridge mode

2014-12-03 Thread Andy Yan

Hi Russell:
On 2014年12月04日 00:33, Russell King - ARM Linux wrote:

On Thu, Dec 04, 2014 at 12:30:23AM +0800, Andy Yan wrote:

On 2014年12月04日 00:11, Russell King - ARM Linux wrote:

I meant that imx_hdmi_bind should be passed these, so that it needs to
know nothing about the struct device beyond the generic device structure.
In other words, the dw-hdmi core should not assume that the struct device
is part of a platform device.


if so, how about the device tree properties  ddc-i2c-bus, reg-io-width,
iahb, isfr,
   they are all found by device?

If the device has a device tree node associated with it, it will have a
non-NULL dev->of_node - which is part of the generic device structure.

  so , I just need get the resource and irq number in the 
dw_hdmi-imx/rockchip ,than
  pass them to imx_hdmi_bind, as the properties ddc-i2c-bus, 
reg-io-width, iahb,isfr, they

  are still can be handled in imx_hdmi_bind ?

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: Possible memory leak in function (reserve_range) not freeing pointer (regionid)

2014-12-03 Thread Ahmed Tamrawi
The bug was found via the  memory-leak static analysis tool that we
have built on top of C-Atlas framework from EnSoft. You can check it
out (http://www.ensoftcorp.com/atlas/).

Thanks for clarifying things!

~Ahmed

On Wed, Dec 3, 2014 at 2:48 AM, Dan Carpenter  wrote:
> This is a real bug, but it's very minor.  To trigger it, you would have
> to modprobe and rmmod many many times in a loop.  If you report these
> sorts of minor bugs when the code is new, then most times people fix
> them but this one is old I doubt anyone is motivated to fix it.  Fixing
> it seems a little complicated to me as well.
>
> I suppose that linux-ker...@vger.kernel.org is the correct mailing list
> to report this but the truth is that no one reads that list.
>
> Anyway, it seems that you have written a good bug finding tool.  :)
> Congratulations for that!
>
> regards,
> dan carpenter
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v16 03/12] drm: imx: imx-hdmi: convert imx-hdmi to drm_bridge mode

2014-12-03 Thread Russell King - ARM Linux
On Thu, Dec 04, 2014 at 12:30:23AM +0800, Andy Yan wrote:
> 
> On 2014年12月04日 00:11, Russell King - ARM Linux wrote:
> >I meant that imx_hdmi_bind should be passed these, so that it needs to
> >know nothing about the struct device beyond the generic device structure.
> >In other words, the dw-hdmi core should not assume that the struct device
> >is part of a platform device.
> >
>if so, how about the device tree properties  ddc-i2c-bus, reg-io-width,
> iahb, isfr,
>   they are all found by device?

If the device has a device tree node associated with it, it will have a
non-NULL dev->of_node - which is part of the generic device structure.

-- 
FTTC broadband for 0.8mile line: currently at 9.5Mbps down 400kbps up
according to speedtest.net.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v16 03/12] drm: imx: imx-hdmi: convert imx-hdmi to drm_bridge mode

2014-12-03 Thread Russell King - ARM Linux
On Wed, Dec 03, 2014 at 05:20:15PM +0100, Philipp Zabel wrote:
> Hi Andy,
> 
> It would be better if the bind function would not have to care about
> platform resources, that should be handled in the probe function. I had
> a patch to move them:
> 
> http://lists.freedesktop.org/archives/dri-devel/2014-May/059630.html
> 
> Maybe you could incorporate something like this?

Personally, I hate this idea.  Having a two-layered setup means that
the when the bind() method is called, the state of struct imx_hdmi is
indeterminant.

If it's called immediately from probe, most of the structure will be
zeroed, and only those members initialised by the probe function will
be set to non-zero values.

However, if the HDMI interface has been previously bound, and is
subsequently re-bound, then the structure will most definitely no
longer be in a known state on the second bind() call.

This is fragile.

Now, people have tried to tell me that this isn't fragile, but, I now
have proof that it is as fragile as I fear.  The component helper
doesn't yet have that many users, and already we have one user (okay,
it's not part of the mainline kernel - it's etnaviv) which contained
exactly this kind of bug: it expected its private structures to be
zeroed on the bind() call.

So, I /really/ hate this idea.  If you really want to do this, then
please ensure that the bind() call explicitly zeros the bits of the
struct which aren't initialised by the probe() call, so we know that
the driver will always start off with a known initial state.

-- 
FTTC broadband for 0.8mile line: currently at 9.5Mbps down 400kbps up
according to speedtest.net.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v16 03/12] drm: imx: imx-hdmi: convert imx-hdmi to drm_bridge mode

2014-12-03 Thread Andy Yan


On 2014年12月04日 00:11, Russell King - ARM Linux wrote:

On Thu, Dec 04, 2014 at 12:04:37AM +0800, Andy Yan wrote:

Hi Russell:

On 2014年12月03日 23:38, Russell King - ARM Linux wrote:

On Wed, Dec 03, 2014 at 11:29:26PM +0800, Andy Yan wrote:

+int imx_hdmi_bind(struct device *dev, struct device *master,
+ void *data, struct drm_encoder *encoder,
+ const struct imx_hdmi_plat_data *plat_data)
  {
struct platform_device *pdev = to_platform_device(dev);
-   const struct of_device_id *of_id =
-   of_match_device(imx_hdmi_dt_ids, dev);
struct drm_device *drm = data;
struct device_node *np = dev->of_node;
struct device_node *ddc_node;
@@ -1594,19 +1566,16 @@ static int imx_hdmi_bind(struct device *dev, struct 
device *master, void *data)
struct resource *iores;
int ret, irq;
-   hdmi = devm_kzalloc(dev, sizeof(*hdmi), GFP_KERNEL);
+   hdmi = devm_kzalloc(&pdev->dev, sizeof(*hdmi), GFP_KERNEL);
if (!hdmi)
return -ENOMEM;
-   hdmi->dev = dev;
+   hdmi->plat_data = plat_data;
+   hdmi->dev = &pdev->dev;
+   hdmi->dev_type = plat_data->dev_type;
hdmi->sample_rate = 48000;
hdmi->ratio = 100;
-
-   if (of_id) {
-   const struct platform_device_id *device_id = of_id->data;
-
-   hdmi->dev_type = device_id->driver_data;
-   }
+   hdmi->encoder = encoder;

I'd suggest changing imx_hdmi_bind() to take the struct resource and irq
number, and avoiding the platform device stuff altogether in here.


Actually this is what the current code do: the resource and irq number
are all handled in imx_hdmi_bind

I meant that imx_hdmi_bind should be passed these, so that it needs to
know nothing about the struct device beyond the generic device structure.
In other words, the dw-hdmi core should not assume that the struct device
is part of a platform device.

   if so, how about the device tree properties  ddc-i2c-bus, 
reg-io-width, iahb, isfr,

  they are all found by device?

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v16 03/12] drm: imx: imx-hdmi: convert imx-hdmi to drm_bridge mode

2014-12-03 Thread Philipp Zabel
Hi Andy,

Am Donnerstag, den 04.12.2014, 00:04 +0800 schrieb Andy Yan:
> On 2014年12月03日 23:38, Russell King - ARM Linux wrote:
> > On Wed, Dec 03, 2014 at 11:29:26PM +0800, Andy Yan wrote:
> >> +int imx_hdmi_bind(struct device *dev, struct device *master,
> >> +void *data, struct drm_encoder *encoder,
> >> +const struct imx_hdmi_plat_data *plat_data)
> >>   {
> >>struct platform_device *pdev = to_platform_device(dev);
> >> -  const struct of_device_id *of_id =
> >> -  of_match_device(imx_hdmi_dt_ids, dev);
> >>struct drm_device *drm = data;
> >>struct device_node *np = dev->of_node;
> >>struct device_node *ddc_node;
> >> @@ -1594,19 +1566,16 @@ static int imx_hdmi_bind(struct device *dev, 
> >> struct device *master, void *data)
> >>struct resource *iores;
> >>int ret, irq;
> >>   
> >> -  hdmi = devm_kzalloc(dev, sizeof(*hdmi), GFP_KERNEL);
> >> +  hdmi = devm_kzalloc(&pdev->dev, sizeof(*hdmi), GFP_KERNEL);
> >>if (!hdmi)
> >>return -ENOMEM;
> >>   
> >> -  hdmi->dev = dev;
> >> +  hdmi->plat_data = plat_data;
> >> +  hdmi->dev = &pdev->dev;
> >> +  hdmi->dev_type = plat_data->dev_type;
> >>hdmi->sample_rate = 48000;
> >>hdmi->ratio = 100;
> >> -
> >> -  if (of_id) {
> >> -  const struct platform_device_id *device_id = of_id->data;
> >> -
> >> -  hdmi->dev_type = device_id->driver_data;
> >> -  }
> >> +  hdmi->encoder = encoder;
> > I'd suggest changing imx_hdmi_bind() to take the struct resource and irq
> > number, and avoiding the platform device stuff altogether in here.
> >
> Actually this is what the current code do: the resource and irq number
> are all handled in imx_hdmi_bind

It would be better if the bind function would not have to care about
platform resources, that should be handled in the probe function. I had
a patch to move them:

http://lists.freedesktop.org/archives/dri-devel/2014-May/059630.html

Maybe you could incorporate something like this?

regards
Philipp

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: rtl8723au: hal: Removed spaces before semicolon

2014-12-03 Thread Anjana Sasindran
This patch fix the checkpatch.pl warning:

WARNING: space prohibited before semicolon

Signed-off-by: Anjana Sasindran 
---
 drivers/staging/rtl8723au/hal/odm_HWConfig.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8723au/hal/odm_HWConfig.c 
b/drivers/staging/rtl8723au/hal/odm_HWConfig.c
index 29d844d..a516b6e 100644
--- a/drivers/staging/rtl8723au/hal/odm_HWConfig.c
+++ b/drivers/staging/rtl8723au/hal/odm_HWConfig.c
@@ -113,7 +113,7 @@ static void odm_RxPhyStatus92CSeries_Parsing(struct 
dm_odm_t *pDM_Odm,
 
cck_highpwr = pDM_Odm->bCckHighPower;
 
-   cck_agc_rpt =  pPhyStaRpt->cck_agc_rpt_ofdm_cfosho_a ;
+   cck_agc_rpt =  pPhyStaRpt->cck_agc_rpt_ofdm_cfosho_a;
 
/* The RSSI formula should be modified according to the gain 
table */
if (!cck_highpwr) {
@@ -138,16 +138,16 @@ static void odm_RxPhyStatus92CSeries_Parsing(struct 
dm_odm_t *pDM_Odm,
report = (cck_agc_rpt & 0x60)>>5;
switch (report) {
case 0x3:
-   rx_pwr_all = -46 - ((cck_agc_rpt & 0x1f)<<1) ;
+   rx_pwr_all = -46 - ((cck_agc_rpt & 0x1f)<<1);
break;
case 0x2:
rx_pwr_all = -26 - ((cck_agc_rpt & 0x1f)<<1);
break;
case 0x1:
-   rx_pwr_all = -12 - ((cck_agc_rpt & 0x1f)<<1) ;
+   rx_pwr_all = -12 - ((cck_agc_rpt & 0x1f)<<1);
break;
case 0x0:
-   rx_pwr_all = 16 - ((cck_agc_rpt & 0x1f)<<1) ;
+   rx_pwr_all = 16 - ((cck_agc_rpt & 0x1f)<<1);
break;
}
}
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v16 03/12] drm: imx: imx-hdmi: convert imx-hdmi to drm_bridge mode

2014-12-03 Thread Russell King - ARM Linux
On Thu, Dec 04, 2014 at 12:04:37AM +0800, Andy Yan wrote:
> Hi Russell:
> 
> On 2014年12月03日 23:38, Russell King - ARM Linux wrote:
> >On Wed, Dec 03, 2014 at 11:29:26PM +0800, Andy Yan wrote:
> >>+int imx_hdmi_bind(struct device *dev, struct device *master,
> >>+ void *data, struct drm_encoder *encoder,
> >>+ const struct imx_hdmi_plat_data *plat_data)
> >>  {
> >>struct platform_device *pdev = to_platform_device(dev);
> >>-   const struct of_device_id *of_id =
> >>-   of_match_device(imx_hdmi_dt_ids, dev);
> >>struct drm_device *drm = data;
> >>struct device_node *np = dev->of_node;
> >>struct device_node *ddc_node;
> >>@@ -1594,19 +1566,16 @@ static int imx_hdmi_bind(struct device *dev, struct 
> >>device *master, void *data)
> >>struct resource *iores;
> >>int ret, irq;
> >>-   hdmi = devm_kzalloc(dev, sizeof(*hdmi), GFP_KERNEL);
> >>+   hdmi = devm_kzalloc(&pdev->dev, sizeof(*hdmi), GFP_KERNEL);
> >>if (!hdmi)
> >>return -ENOMEM;
> >>-   hdmi->dev = dev;
> >>+   hdmi->plat_data = plat_data;
> >>+   hdmi->dev = &pdev->dev;
> >>+   hdmi->dev_type = plat_data->dev_type;
> >>hdmi->sample_rate = 48000;
> >>hdmi->ratio = 100;
> >>-
> >>-   if (of_id) {
> >>-   const struct platform_device_id *device_id = of_id->data;
> >>-
> >>-   hdmi->dev_type = device_id->driver_data;
> >>-   }
> >>+   hdmi->encoder = encoder;
> >I'd suggest changing imx_hdmi_bind() to take the struct resource and irq
> >number, and avoiding the platform device stuff altogether in here.
> >
>Actually this is what the current code do: the resource and irq number
> are all handled in imx_hdmi_bind

I meant that imx_hdmi_bind should be passed these, so that it needs to
know nothing about the struct device beyond the generic device structure.
In other words, the dw-hdmi core should not assume that the struct device
is part of a platform device.

-- 
FTTC broadband for 0.8mile line: currently at 9.5Mbps down 400kbps up
according to speedtest.net.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v16 05/12] drm: imx: imx-hdmi: move imx-hdmi to bridge/dw_hdmi

2014-12-03 Thread Russell King - ARM Linux
On Thu, Dec 04, 2014 at 12:01:25AM +0800, Andy Yan wrote:
> Hi Russell:
>   Do you mean I just neet to do like bellow?
> 
> +
> +config DRM_DW_HDMI
> + bool
> + depends on DRM
> + select DRM_KMS_HELPER

Yep.

-- 
FTTC broadband for 0.8mile line: currently at 9.5Mbps down 400kbps up
according to speedtest.net.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v16 03/12] drm: imx: imx-hdmi: convert imx-hdmi to drm_bridge mode

2014-12-03 Thread Andy Yan

Hi Russell:

On 2014年12月03日 23:38, Russell King - ARM Linux wrote:

On Wed, Dec 03, 2014 at 11:29:26PM +0800, Andy Yan wrote:

+int imx_hdmi_bind(struct device *dev, struct device *master,
+ void *data, struct drm_encoder *encoder,
+ const struct imx_hdmi_plat_data *plat_data)
  {
struct platform_device *pdev = to_platform_device(dev);
-   const struct of_device_id *of_id =
-   of_match_device(imx_hdmi_dt_ids, dev);
struct drm_device *drm = data;
struct device_node *np = dev->of_node;
struct device_node *ddc_node;
@@ -1594,19 +1566,16 @@ static int imx_hdmi_bind(struct device *dev, struct 
device *master, void *data)
struct resource *iores;
int ret, irq;
  
-	hdmi = devm_kzalloc(dev, sizeof(*hdmi), GFP_KERNEL);

+   hdmi = devm_kzalloc(&pdev->dev, sizeof(*hdmi), GFP_KERNEL);
if (!hdmi)
return -ENOMEM;
  
-	hdmi->dev = dev;

+   hdmi->plat_data = plat_data;
+   hdmi->dev = &pdev->dev;
+   hdmi->dev_type = plat_data->dev_type;
hdmi->sample_rate = 48000;
hdmi->ratio = 100;
-
-   if (of_id) {
-   const struct platform_device_id *device_id = of_id->data;
-
-   hdmi->dev_type = device_id->driver_data;
-   }
+   hdmi->encoder = encoder;

I'd suggest changing imx_hdmi_bind() to take the struct resource and irq
number, and avoiding the platform device stuff altogether in here.


   Actually this is what the current code do: the resource and irq number
are all handled in imx_hdmi_bind


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v16 05/12] drm: imx: imx-hdmi: move imx-hdmi to bridge/dw_hdmi

2014-12-03 Thread Andy Yan

Hi Russell:

On 2014年12月03日 23:45, Russell King - ARM Linux wrote:

On Wed, Dec 03, 2014 at 11:32:12PM +0800, Andy Yan wrote:

diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index 884923f..26162ef 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -3,3 +3,8 @@ config DRM_PTN3460
depends on DRM
select DRM_KMS_HELPER
---help---
+
+config DRM_DW_HDMI
+   bool "Synopsys DesignWare High-Definition Multimedia Interface"
+   depends on DRM
+   select DRM_KMS_HELPER

...

diff --git a/drivers/gpu/drm/imx/Kconfig b/drivers/gpu/drm/imx/Kconfig
index 82fb758..7070077 100644
--- a/drivers/gpu/drm/imx/Kconfig
+++ b/drivers/gpu/drm/imx/Kconfig
@@ -48,6 +48,7 @@ config DRM_IMX_IPUV3
  
  config DRM_IMX_HDMI

tristate "Freescale i.MX DRM HDMI"
+   select DRM_DW_HDMI
depends on DRM_IMX
help
  Choose this if you want to use HDMI on i.MX6.

I'd recommend that if you want to select DRM_DW_HDMI, then don't give
DRM_DW_HDMI a prompt message.  I assume you're going to do something
similar with your Rockchip driver too - in which case DRM_DW_HDMI is
really about building a library module.

  Do you mean I just neet to do like bellow?

+
+config DRM_DW_HDMI
+   bool
+   depends on DRM
+   select DRM_KMS_HELPER



___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v16 05/12] drm: imx: imx-hdmi: move imx-hdmi to bridge/dw_hdmi

2014-12-03 Thread Russell King - ARM Linux
On Wed, Dec 03, 2014 at 11:32:12PM +0800, Andy Yan wrote:
> diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
> index 884923f..26162ef 100644
> --- a/drivers/gpu/drm/bridge/Kconfig
> +++ b/drivers/gpu/drm/bridge/Kconfig
> @@ -3,3 +3,8 @@ config DRM_PTN3460
>   depends on DRM
>   select DRM_KMS_HELPER
>   ---help---
> +
> +config DRM_DW_HDMI
> + bool "Synopsys DesignWare High-Definition Multimedia Interface"
> + depends on DRM
> + select DRM_KMS_HELPER
...
> diff --git a/drivers/gpu/drm/imx/Kconfig b/drivers/gpu/drm/imx/Kconfig
> index 82fb758..7070077 100644
> --- a/drivers/gpu/drm/imx/Kconfig
> +++ b/drivers/gpu/drm/imx/Kconfig
> @@ -48,6 +48,7 @@ config DRM_IMX_IPUV3
>  
>  config DRM_IMX_HDMI
>   tristate "Freescale i.MX DRM HDMI"
> + select DRM_DW_HDMI
>   depends on DRM_IMX
>   help
> Choose this if you want to use HDMI on i.MX6.

I'd recommend that if you want to select DRM_DW_HDMI, then don't give
DRM_DW_HDMI a prompt message.  I assume you're going to do something
similar with your Rockchip driver too - in which case DRM_DW_HDMI is
really about building a library module.

-- 
FTTC broadband for 0.8mile line: currently at 9.5Mbps down 400kbps up
according to speedtest.net.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v16 03/12] drm: imx: imx-hdmi: convert imx-hdmi to drm_bridge mode

2014-12-03 Thread Russell King - ARM Linux
On Wed, Dec 03, 2014 at 11:29:26PM +0800, Andy Yan wrote:
> +int imx_hdmi_bind(struct device *dev, struct device *master,
> +   void *data, struct drm_encoder *encoder,
> +   const struct imx_hdmi_plat_data *plat_data)
>  {
>   struct platform_device *pdev = to_platform_device(dev);
> - const struct of_device_id *of_id =
> - of_match_device(imx_hdmi_dt_ids, dev);
>   struct drm_device *drm = data;
>   struct device_node *np = dev->of_node;
>   struct device_node *ddc_node;
> @@ -1594,19 +1566,16 @@ static int imx_hdmi_bind(struct device *dev, struct 
> device *master, void *data)
>   struct resource *iores;
>   int ret, irq;
>  
> - hdmi = devm_kzalloc(dev, sizeof(*hdmi), GFP_KERNEL);
> + hdmi = devm_kzalloc(&pdev->dev, sizeof(*hdmi), GFP_KERNEL);
>   if (!hdmi)
>   return -ENOMEM;
>  
> - hdmi->dev = dev;
> + hdmi->plat_data = plat_data;
> + hdmi->dev = &pdev->dev;
> + hdmi->dev_type = plat_data->dev_type;
>   hdmi->sample_rate = 48000;
>   hdmi->ratio = 100;
> -
> - if (of_id) {
> - const struct platform_device_id *device_id = of_id->data;
> -
> - hdmi->dev_type = device_id->driver_data;
> - }
> + hdmi->encoder = encoder;

I'd suggest changing imx_hdmi_bind() to take the struct resource and irq
number, and avoiding the platform device stuff altogether in here.

-- 
FTTC broadband for 0.8mile line: currently at 9.5Mbps down 400kbps up
according to speedtest.net.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v16 12/12] drm: bridge/dw_hdmi: add rockchip rk3288 support

2014-12-03 Thread Andy Yan
Rockchip RK3288 hdmi is compatible with dw_hdmi

this patch is depend on patch by Mark Yao
see https://lkml.org/lkml/2014/12/2/161
drm: rockchip: Add basic drm driver

Signed-off-by: Andy Yan 

---

Changes in v16: None
Changes in v15:
- remove THIS_MODULE in platform driver

Changes in v14: None
Changes in v13: None
Changes in v12:
- add comment for the depend on patch

Changes in v11: None
Changes in v10:
- add more display mode support mpll configuration for rk3288

Changes in v9:
- move some phy configuration to platform driver

Changes in v8: None
Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None

 drivers/gpu/drm/bridge/dw_hdmi.c|   3 +
 drivers/gpu/drm/rockchip/Kconfig|  10 +
 drivers/gpu/drm/rockchip/Makefile   |   2 +
 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 321 
 include/drm/bridge/dw_hdmi.h|   1 +
 5 files changed, 337 insertions(+)
 create mode 100644 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c

diff --git a/drivers/gpu/drm/bridge/dw_hdmi.c b/drivers/gpu/drm/bridge/dw_hdmi.c
index efc3b6f..1d5a6b3 100644
--- a/drivers/gpu/drm/bridge/dw_hdmi.c
+++ b/drivers/gpu/drm/bridge/dw_hdmi.c
@@ -852,6 +852,9 @@ static int hdmi_phy_configure(struct dw_hdmi *hdmi, 
unsigned char prep,
dw_hdmi_phy_gen2_txpwron(hdmi, 1);
dw_hdmi_phy_gen2_pddq(hdmi, 0);
 
+   if (hdmi->dev_type == RK3288_HDMI)
+   dw_hdmi_phy_enable_spare(hdmi, 1);
+
/*Wait for PHY PLL lock */
msec = 5;
do {
diff --git a/drivers/gpu/drm/rockchip/Kconfig b/drivers/gpu/drm/rockchip/Kconfig
index ca9f085..6ebebe8 100644
--- a/drivers/gpu/drm/rockchip/Kconfig
+++ b/drivers/gpu/drm/rockchip/Kconfig
@@ -15,3 +15,13 @@ config DRM_ROCKCHIP
  management to userspace. This driver does not provide
  2D or 3D acceleration; acceleration is performed by other
  IP found on the SoC.
+
+config ROCKCHIP_DW_HDMI
+bool "Rockchip specific extensions for Synopsys DW HDMI"
+depends on DRM_ROCKCHIP
+select DRM_DW_HDMI
+help
+ This selects support for Rockchip SoC specific extensions
+ for the Synopsys DesignWare HDMI driver. If you want to
+ enable HDMI on RK3288 based SoC, you should selet this
+ option.
diff --git a/drivers/gpu/drm/rockchip/Makefile 
b/drivers/gpu/drm/rockchip/Makefile
index 2cb0672..beed7df 100644
--- a/drivers/gpu/drm/rockchip/Makefile
+++ b/drivers/gpu/drm/rockchip/Makefile
@@ -5,4 +5,6 @@
 rockchipdrm-y := rockchip_drm_drv.o rockchip_drm_fb.o rockchip_drm_fbdev.o \
rockchip_drm_gem.o
 
+rockchipdrm-$(CONFIG_ROCKCHIP_DW_HDMI) += dw_hdmi-rockchip.o
+
 obj-$(CONFIG_DRM_ROCKCHIP) += rockchipdrm.o rockchip_drm_vop.o
diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c 
b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
new file mode 100644
index 000..3369a7e
--- /dev/null
+++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
@@ -0,0 +1,321 @@
+/*
+ * Copyright (c) 2014, Fuzhou Rockchip Electronics Co., Ltd
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "rockchip_drm_drv.h"
+#include "rockchip_drm_vop.h"
+
+#define GRF_SOC_CON60x025c
+#define HDMI_SEL_VOP_LIT(1 << 4)
+
+struct rockchip_hdmi {
+   struct device *dev;
+   struct regmap *regmap;
+   struct drm_encoder encoder;
+};
+
+#define to_rockchip_hdmi(x)container_of(x, struct rockchip_hdmi, x)
+
+static const struct dw_hdmi_mpll_config rockchip_mpll_cfg[] = {
+   {
+   2700, {
+   { 0x00b3, 0x},
+   { 0x2153, 0x},
+   { 0x40f3, 0x}
+   },
+   }, {
+   3600, {
+   { 0x00b3, 0x},
+   { 0x2153, 0x},
+   { 0x40f3, 0x}
+   },
+   }, {
+   4000, {
+   { 0x00b3, 0x},
+   { 0x2153, 0x},
+   { 0x40f3, 0x}
+   },
+   }, {
+   5400, {
+   { 0x0072, 0x0001},
+   { 0x2142, 0x0001},
+   { 0x40a2, 0x0001},
+   },
+   }, {
+   6500, {
+   { 0x0072, 0x0001},
+   { 0x2142, 0x0001},
+   { 0x40a2, 0x0001},
+   },
+   }, {
+   6600, {
+   { 0x013e, 0x0003},
+   { 0x217e, 0x0002},
+  

[PATCH v16 11/12] dt-bindings: Add documentation for rockchip dw hdmi

2014-12-03 Thread Andy Yan
Signed-off-by: Andy Yan 

---

Changes in v16:
- modify clocks bindings
- descrbie ddc-i2c-bus as optional

Changes in v15: None
Changes in v14: None
Changes in v13: None
Changes in v12: None
Changes in v11: None
Changes in v10: None
Changes in v9: None
Changes in v8:
- Add documentation for rockchip dw hdmi

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None

 .../devicetree/bindings/video/dw_hdmi-rockchip.txt | 46 ++
 1 file changed, 46 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/video/dw_hdmi-rockchip.txt

diff --git a/Documentation/devicetree/bindings/video/dw_hdmi-rockchip.txt 
b/Documentation/devicetree/bindings/video/dw_hdmi-rockchip.txt
new file mode 100644
index 000..264cb4f
--- /dev/null
+++ b/Documentation/devicetree/bindings/video/dw_hdmi-rockchip.txt
@@ -0,0 +1,46 @@
+Rockchip specific extensions to the Synopsys Designware HDMI
+
+
+Required properties:
+- compatible: "rockchip,rk3288-dw-hdmi";
+- reg: Physical base address and length of the controller's registers.
+- clocks: phandle to hdmi iahb and isrf clocks.
+- clock-names: should be "iahb" "isfr"
+- rockchip,grf: this soc should set GRF regs to mux vopl/vopb.
+- interrupts: HDMI interrupt number
+- ports: contain a port node with endpoint definitions as defined in
+  Documentation/devicetree/bindings/media/video-interfaces.txt. For
+  vopb,set the reg = <0> and set the reg = <1> for vopl.
+- reg-io-width: the width of the reg:1,4, the value should be 4 on
+  rk3288 platform
+
+Optional properties
+- ddc-i2c-bus: phandle of an I2C controller used for DDC EDID probing
+- clkocks, clock-names: phandle to the HDMI cec clock, name should be "cec"
+
+Example:
+hdmi: hdmi@ff98 {
+   compatible = "rockchip,rk3288-dw-hdmi";
+   reg = <0xff98 0x2>;
+   reg-io-width = <4>;
+   ddc-i2c-bus = <&i2c5>;
+   rockchip,grf = <&grf>;
+   interrupts = ;
+   clocks = <&cru  PCLK_HDMI_CTRL>, <&cru SCLK_HDMI_HDCP>;
+   clock-names = "iahb", "isfr";
+   status = "disabled";
+   ports {
+   hdmi_in: port {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   hdmi_in_vopb: endpoint@0 {
+   reg = <0>;
+   remote-endpoint = <&vopb_out_hdmi>;
+   };
+   hdmi_in_vopl: endpoint@1 {
+   reg = <1>;
+   remote-endpoint = <&vopl_out_hdmi>;
+   };
+   };
+   };
+};
-- 
1.9.1


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v16 10/12] drm: bridge/dw_hdmi: add function dw_hdmi_phy_enable_spare

2014-12-03 Thread Andy Yan
RK3288 HDMI will not work without the spare bit of
HDMI_PHY_CONF0 enable

Signed-off-by: Andy Yan 
---

Changes in v16: None
Changes in v15: None
Changes in v14: None
Changes in v13: None
Changes in v12: None
Changes in v11: None
Changes in v10: None
Changes in v9: None
Changes in v8: None
Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None

 drivers/gpu/drm/bridge/dw_hdmi.c | 7 +++
 drivers/gpu/drm/bridge/dw_hdmi.h | 3 ++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/bridge/dw_hdmi.c b/drivers/gpu/drm/bridge/dw_hdmi.c
index e53dae0..efc3b6f 100644
--- a/drivers/gpu/drm/bridge/dw_hdmi.c
+++ b/drivers/gpu/drm/bridge/dw_hdmi.c
@@ -713,6 +713,13 @@ static void dw_hdmi_phy_enable_tmds(struct dw_hdmi *hdmi, 
u8 enable)
 HDMI_PHY_CONF0_ENTMDS_MASK);
 }
 
+static void dw_hdmi_phy_enable_spare(struct dw_hdmi *hdmi, u8 enable)
+{
+   hdmi_mask_writeb(hdmi, enable, HDMI_PHY_CONF0,
+HDMI_PHY_CONF0_SPARECTRL_OFFSET,
+HDMI_PHY_CONF0_SPARECTRL_MASK);
+}
+
 static void dw_hdmi_phy_gen2_pddq(struct dw_hdmi *hdmi, u8 enable)
 {
hdmi_mask_writeb(hdmi, enable, HDMI_PHY_CONF0,
diff --git a/drivers/gpu/drm/bridge/dw_hdmi.h b/drivers/gpu/drm/bridge/dw_hdmi.h
index baa7849..175dbc8 100644
--- a/drivers/gpu/drm/bridge/dw_hdmi.h
+++ b/drivers/gpu/drm/bridge/dw_hdmi.h
@@ -837,7 +837,8 @@ enum {
HDMI_PHY_CONF0_PDZ_OFFSET = 7,
HDMI_PHY_CONF0_ENTMDS_MASK = 0x40,
HDMI_PHY_CONF0_ENTMDS_OFFSET = 6,
-   HDMI_PHY_CONF0_SPARECTRL = 0x20,
+   HDMI_PHY_CONF0_SPARECTRL_MASK = 0x20,
+   HDMI_PHY_CONF0_SPARECTRL_OFFSET = 5,
HDMI_PHY_CONF0_GEN2_PDDQ_MASK = 0x10,
HDMI_PHY_CONF0_GEN2_PDDQ_OFFSET = 4,
HDMI_PHY_CONF0_GEN2_TXPWRON_MASK = 0x8,
-- 
1.9.1


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v16 09/12] drm: bridge/dw_hdmi: clear i2cmphy_stat0 reg in hdmi_phy_wait_i2c_done

2014-12-03 Thread Andy Yan
HDMI_IH_I2CMPHY_STAT0 is a clear on write register, which indicates i2cm
operation status(i2c transfer done or error), every hdmi phy register
configuration must check this register to make sure the configuration
has complete. But the indication bit should be cleared after check, otherwise
the corresponding bit will hold on forever, this may give a wrong signal for
next check.

Signed-off-by: Andy Yan 
---

Changes in v16: None
Changes in v15: None
Changes in v14: None
Changes in v13: None
Changes in v12: None
Changes in v11: None
Changes in v10: None
Changes in v9: None
Changes in v8: None
Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None

 drivers/gpu/drm/bridge/dw_hdmi.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/bridge/dw_hdmi.c b/drivers/gpu/drm/bridge/dw_hdmi.c
index e3999da..e53dae0 100644
--- a/drivers/gpu/drm/bridge/dw_hdmi.c
+++ b/drivers/gpu/drm/bridge/dw_hdmi.c
@@ -666,11 +666,15 @@ static inline void hdmi_phy_test_dout(struct dw_hdmi 
*hdmi,
 
 static bool hdmi_phy_wait_i2c_done(struct dw_hdmi *hdmi, int msec)
 {
-   while ((hdmi_readb(hdmi, HDMI_IH_I2CMPHY_STAT0) & 0x3) == 0) {
+   u32 val;
+
+   while ((val = hdmi_readb(hdmi, HDMI_IH_I2CMPHY_STAT0) & 0x3) == 0) {
if (msec-- == 0)
return false;
udelay(1000);
}
+   hdmi_writeb(hdmi, val, HDMI_IH_I2CMPHY_STAT0);
+
return true;
 }
 
-- 
1.9.1


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v16 08/12] drm: bridge/dw_hdmi: add mode_valid support

2014-12-03 Thread Andy Yan
some platform may not support all the display mode,
add mode_valid interface check it

Signed-off-by: Andy Yan 

---

Changes in v16: None
Changes in v15: None
Changes in v14:
- remove drm_connector_register, because imx-drm core has registered
connector

Changes in v13: None
Changes in v12: None
Changes in v11: None
Changes in v10: None
Changes in v9: None
Changes in v8: None
Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None

 drivers/gpu/drm/bridge/dw_hdmi.c | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/drivers/gpu/drm/bridge/dw_hdmi.c b/drivers/gpu/drm/bridge/dw_hdmi.c
index d2c6ba8..e3999da 100644
--- a/drivers/gpu/drm/bridge/dw_hdmi.c
+++ b/drivers/gpu/drm/bridge/dw_hdmi.c
@@ -1405,6 +1405,20 @@ static int dw_hdmi_connector_get_modes(struct 
drm_connector *connector)
return 0;
 }
 
+static enum drm_mode_status
+dw_hdmi_connector_mode_valid(struct drm_connector *connector,
+struct drm_display_mode *mode)
+{
+   struct dw_hdmi *hdmi = container_of(connector,
+  struct dw_hdmi, connector);
+   enum drm_mode_status mode_status = MODE_OK;
+
+   if (hdmi->plat_data->mode_valid)
+   mode_status = hdmi->plat_data->mode_valid(connector, mode);
+
+   return mode_status;
+}
+
 static struct drm_encoder *dw_hdmi_connector_best_encoder(struct drm_connector
   *connector)
 {
@@ -1429,6 +1443,7 @@ static struct drm_connector_funcs dw_hdmi_connector_funcs 
= {
 
 static struct drm_connector_helper_funcs dw_hdmi_connector_helper_funcs = {
.get_modes = dw_hdmi_connector_get_modes,
+   .mode_valid = dw_hdmi_connector_mode_valid,
.best_encoder = dw_hdmi_connector_best_encoder,
 };
 
-- 
1.9.1


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v16 07/12] drm: bridge/dw_hdmi: add support for multi-byte register width access

2014-12-03 Thread Andy Yan
On rockchip rk3288, only word(32-bit) accesses are
permitted for hdmi registers.  Byte width accesses (writeb,
readb) generate an imprecise external abort.

Signed-off-by: Andy Yan 

---

Changes in v16: None
Changes in v15:
- remove unio of the multi-byte register access, adviced by Philipp Zabel

Changes in v14: None
Changes in v13: None
Changes in v12: None
Changes in v11: None
Changes in v10: None
Changes in v9: None
Changes in v8: None
Changes in v7: None
Changes in v6:
- refactor register access without reg_shift

Changes in v5:
- refactor reg-io-width

Changes in v4: None
Changes in v3:
- split multi-register access to one indepent patch

 drivers/gpu/drm/bridge/dw_hdmi.c | 44 ++--
 1 file changed, 42 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/bridge/dw_hdmi.c b/drivers/gpu/drm/bridge/dw_hdmi.c
index ac5f5e2..d2c6ba8 100644
--- a/drivers/gpu/drm/bridge/dw_hdmi.c
+++ b/drivers/gpu/drm/bridge/dw_hdmi.c
@@ -128,18 +128,41 @@ struct dw_hdmi {
 
unsigned int sample_rate;
int ratio;
+
+   void (*write)(struct dw_hdmi *hdmi, u8 val, int offset);
+   u8 (*read)(struct dw_hdmi *hdmi, int offset);
 };
 
-static inline void hdmi_writeb(struct dw_hdmi *hdmi, u8 val, int offset)
+static void dw_hdmi_writel(struct dw_hdmi *hdmi, u8 val, int offset)
+{
+   writel(val, hdmi->regs + (offset << 2));
+}
+
+static u8 dw_hdmi_readl(struct dw_hdmi *hdmi, int offset)
+{
+   return readl(hdmi->regs + (offset << 2));
+}
+
+static void dw_hdmi_writeb(struct dw_hdmi *hdmi, u8 val, int offset)
 {
writeb(val, hdmi->regs + offset);
 }
 
-static inline u8 hdmi_readb(struct dw_hdmi *hdmi, int offset)
+static u8 dw_hdmi_readb(struct dw_hdmi *hdmi, int offset)
 {
return readb(hdmi->regs + offset);
 }
 
+static inline void hdmi_writeb(struct dw_hdmi *hdmi, u8 val, int offset)
+{
+   hdmi->write(hdmi, val, offset);
+}
+
+static inline u8 hdmi_readb(struct dw_hdmi *hdmi, int offset)
+{
+   return hdmi->read(hdmi, offset);
+}
+
 static void hdmi_modb(struct dw_hdmi *hdmi, u8 data, u8 mask, unsigned reg)
 {
u8 val = hdmi_readb(hdmi, reg) & ~mask;
@@ -1512,6 +1535,7 @@ int dw_hdmi_bind(struct device *dev, struct device 
*master,
struct dw_hdmi *hdmi;
struct resource *iores;
int ret, irq;
+   u32 val = 1;
 
hdmi = devm_kzalloc(&pdev->dev, sizeof(*hdmi), GFP_KERNEL);
if (!hdmi)
@@ -1524,6 +1548,22 @@ int dw_hdmi_bind(struct device *dev, struct device 
*master,
hdmi->ratio = 100;
hdmi->encoder = encoder;
 
+   of_property_read_u32(np, "reg-io-width", &val);
+
+   switch (val) {
+   case 4:
+   hdmi->write = dw_hdmi_writel;
+   hdmi->read = dw_hdmi_readl;
+   break;
+   case 1:
+   hdmi->write = dw_hdmi_writeb;
+   hdmi->read = dw_hdmi_readb;
+   break;
+   default:
+   dev_err(dev, "reg-io-width must be 1 or 4\n");
+   return -EINVAL;
+   }
+
ddc_node = of_parse_phandle(np, "ddc-i2c-bus", 0);
if (ddc_node) {
hdmi->ddc = of_find_i2c_adapter_by_node(ddc_node);
-- 
1.9.1


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v16 06/12] dt-bindings: add document for dw_hdmi

2014-12-03 Thread Andy Yan
Signed-off-by: Andy Yan 

---

Changes in v16:
- describe ddc-i2c-bus as optional
- add common clocks bindings

Changes in v15: None
Changes in v14: None
Changes in v13: None
Changes in v12: None
Changes in v11: None
Changes in v10: None
Changes in v9: None
Changes in v8:
- correct some spelling mistake
- modify ddc-i2c-bus and interrupt description

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None

 .../devicetree/bindings/drm/bridge/dw_hdmi.txt | 45 ++
 1 file changed, 45 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt

diff --git a/Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt 
b/Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt
new file mode 100644
index 000..fb14730
--- /dev/null
+++ b/Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt
@@ -0,0 +1,45 @@
+DesignWare HDMI bridge bindings
+
+Required properities:
+- compatible: platform specific such as:
+   * "snps,dw-hdmi-tx"
+   * "fsl,imx6q-hdmi"
+   * "fsl,imx6dl-hdmi"
+   * "rockchip,rk3288-dw-hdmi"
+- reg: Physical base address and length of the controller's registers.
+- interrupts: The HDMI interrupt number
+- clocks, clock-names : must have the phandles to the HDMI iahb and isrf 
clocks,
+  as described in Documentation/devicetree/bindings/clock/clock-bindings.txt,
+  the clock-names should be "iahb", "isfr"
+
+Optional properties
+- reg-io-width: the width of the reg:1,4, default set to 1 if not present
+- ddc-i2c-bus: phandle of an I2C controller used for DDC EDID probing
+- clkocks, clock-names: phandle to the HDMI cec clock, name should be "cec"
+
+Example:
+   hdmi: hdmi@012 {
+   compatible = "fsl,imx6q-hdmi";
+   reg = <0x0012 0x9000>;
+   interrupts = <0 115 0x04>;
+   gpr = <&gpr>;
+   clocks = <&clks 123>, <&clks 124>;
+   clock-names = "iahb", "isfr";
+   ddc-i2c-bus = <&i2c2>;
+
+   port@0 {
+   reg = <0>;
+
+   hdmi_mux_0: endpoint {
+   remote-endpoint = <&ipu1_di0_hdmi>;
+   };
+   };
+
+   port@1 {
+   reg = <1>;
+
+   hdmi_mux_1: endpoint {
+   remote-endpoint = <&ipu1_di1_hdmi>;
+   };
+   };
+   };
-- 
1.9.1


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v16 05/12] drm: imx: imx-hdmi: move imx-hdmi to bridge/dw_hdmi

2014-12-03 Thread Andy Yan
the original imx hdmi driver is under drm/imx/,
which depends on imx-drm, so move the imx hdmi
driver out to drm/bridge and rename it to dw_hdmi

Signed-off-by: Andy Yan 

---

Changes in v16: None
Changes in v15:
- add prefix dw_hdmi/DW_HDMI for public used dw_hdmi structs
  adviced by Philipp Zabel
- remove THIS_MODULE in platform driver

Changes in v14: None
Changes in v13: None
Changes in v12: None
Changes in v11: None
Changes in v10: None
Changes in v9: None
Changes in v8: None
Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None

 drivers/gpu/drm/bridge/Kconfig |   5 +
 drivers/gpu/drm/bridge/Makefile|   1 +
 .../gpu/drm/{imx/imx-hdmi.c => bridge/dw_hdmi.c}   | 282 +++--
 .../gpu/drm/{imx/imx-hdmi.h => bridge/dw_hdmi.h}   |  42 ---
 drivers/gpu/drm/imx/Kconfig|   1 +
 drivers/gpu/drm/imx/Makefile   |   2 +-
 .../drm/imx/{imx-hdmi_pltfm.c => dw_hdmi-imx.c}| 127 +-
 include/drm/bridge/dw_hdmi.h   |  59 +
 8 files changed, 271 insertions(+), 248 deletions(-)
 rename drivers/gpu/drm/{imx/imx-hdmi.c => bridge/dw_hdmi.c} (84%)
 rename drivers/gpu/drm/{imx/imx-hdmi.h => bridge/dw_hdmi.h} (98%)
 rename drivers/gpu/drm/imx/{imx-hdmi_pltfm.c => dw_hdmi-imx.c} (53%)
 create mode 100644 include/drm/bridge/dw_hdmi.h

diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index 884923f..26162ef 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -3,3 +3,8 @@ config DRM_PTN3460
depends on DRM
select DRM_KMS_HELPER
---help---
+
+config DRM_DW_HDMI
+   bool "Synopsys DesignWare High-Definition Multimedia Interface"
+   depends on DRM
+   select DRM_KMS_HELPER
diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
index b4733e1..d8a8cfd 100644
--- a/drivers/gpu/drm/bridge/Makefile
+++ b/drivers/gpu/drm/bridge/Makefile
@@ -1,3 +1,4 @@
 ccflags-y := -Iinclude/drm
 
 obj-$(CONFIG_DRM_PTN3460) += ptn3460.o
+obj-$(CONFIG_DRM_DW_HDMI) += dw_hdmi.o
diff --git a/drivers/gpu/drm/imx/imx-hdmi.c b/drivers/gpu/drm/bridge/dw_hdmi.c
similarity index 84%
rename from drivers/gpu/drm/imx/imx-hdmi.c
rename to drivers/gpu/drm/bridge/dw_hdmi.c
index 4ad6663..ac5f5e2 100644
--- a/drivers/gpu/drm/imx/imx-hdmi.c
+++ b/drivers/gpu/drm/bridge/dw_hdmi.c
@@ -6,12 +6,11 @@
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
- * SH-Mobile High-Definition Multimedia Interface (HDMI) driver
- * for SLISHDMI13T and SLIPHDMIT IP cores
+ * Designware High-Definition Multimedia Interface (HDMI) driver
  *
  * Copyright (C) 2010, Guennadi Liakhovetski 
  */
-
+#include 
 #include 
 #include 
 #include 
@@ -24,8 +23,9 @@
 #include 
 #include 
 #include 
+#include 
 
-#include "imx-hdmi.h"
+#include "dw_hdmi.h"
 
 #define HDMI_EDID_LEN  512
 
@@ -101,18 +101,19 @@ struct hdmi_data_info {
struct hdmi_vmode video_mode;
 };
 
-struct imx_hdmi {
+struct dw_hdmi {
struct drm_connector connector;
struct drm_encoder *encoder;
struct drm_bridge *bridge;
 
-   enum imx_hdmi_devtype dev_type;
+   enum dw_hdmi_devtype dev_type;
struct device *dev;
struct clk *isfr_clk;
struct clk *iahb_clk;
 
struct hdmi_data_info hdmi_data;
-   const struct imx_hdmi_plat_data *plat_data;
+   const struct dw_hdmi_plat_data *plat_data;
+
int vic;
 
u8 edid[HDMI_EDID_LEN];
@@ -129,17 +130,17 @@ struct imx_hdmi {
int ratio;
 };
 
-static inline void hdmi_writeb(struct imx_hdmi *hdmi, u8 val, int offset)
+static inline void hdmi_writeb(struct dw_hdmi *hdmi, u8 val, int offset)
 {
writeb(val, hdmi->regs + offset);
 }
 
-static inline u8 hdmi_readb(struct imx_hdmi *hdmi, int offset)
+static inline u8 hdmi_readb(struct dw_hdmi *hdmi, int offset)
 {
return readb(hdmi->regs + offset);
 }
 
-static void hdmi_modb(struct imx_hdmi *hdmi, u8 data, u8 mask, unsigned reg)
+static void hdmi_modb(struct dw_hdmi *hdmi, u8 data, u8 mask, unsigned reg)
 {
u8 val = hdmi_readb(hdmi, reg) & ~mask;
 
@@ -147,13 +148,13 @@ static void hdmi_modb(struct imx_hdmi *hdmi, u8 data, u8 
mask, unsigned reg)
hdmi_writeb(hdmi, val, reg);
 }
 
-static void hdmi_mask_writeb(struct imx_hdmi *hdmi, u8 data, unsigned int reg,
+static void hdmi_mask_writeb(struct dw_hdmi *hdmi, u8 data, unsigned int reg,
 u8 shift, u8 mask)
 {
hdmi_modb(hdmi, data << shift, mask, reg);
 }
 
-static void hdmi_set_clock_regenerator_n(struct imx_hdmi *hdmi,
+static void hdmi_set_clock_regenerator_n(struct dw_hdmi *hdmi,
 unsigned int value)
 {
hdmi_writeb(hdmi, value & 0xff, HDMI_AUD_N1);
@@ -164,7 +165,7 @@ static void hdmi_set_clock_regenerator_n(struct imx_hdmi 
*

[PATCH v16 04/12] drm: imx: imx-hdmi: split phy configuration to platform driver

2014-12-03 Thread Andy Yan
hdmi phy configuration is platform specific, which can be adusted
according to the board to get the best SI

Signed-off-by: Andy Yan 

---

Changes in v16: None
Changes in v15: None
Changes in v14: None
Changes in v13:
- split phy configuration from patch#4

Changes in v12: None
Changes in v11: None
Changes in v10: None
Changes in v9: None
Changes in v8: None
Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None

 drivers/gpu/drm/imx/imx-hdmi.c   | 85 +++-
 drivers/gpu/drm/imx/imx-hdmi.h   | 29 
 drivers/gpu/drm/imx/imx-hdmi_pltfm.c | 57 
 3 files changed, 101 insertions(+), 70 deletions(-)

diff --git a/drivers/gpu/drm/imx/imx-hdmi.c b/drivers/gpu/drm/imx/imx-hdmi.c
index a7c1ec7..4ad6663 100644
--- a/drivers/gpu/drm/imx/imx-hdmi.c
+++ b/drivers/gpu/drm/imx/imx-hdmi.c
@@ -713,76 +713,14 @@ static void imx_hdmi_phy_sel_interface_control(struct 
imx_hdmi *hdmi, u8 enable)
 HDMI_PHY_CONF0_SELDIPIF_MASK);
 }
 
-enum {
-   RES_8,
-   RES_10,
-   RES_12,
-   RES_MAX,
-};
-
-struct mpll_config {
-   unsigned long mpixelclock;
-   struct {
-   u16 cpce;
-   u16 gmp;
-   } res[RES_MAX];
-};
-
-static const struct mpll_config mpll_config[] = {
-   {
-   4525, {
-   { 0x01e0, 0x },
-   { 0x21e1, 0x },
-   { 0x41e2, 0x }
-   },
-   }, {
-   9250, {
-   { 0x0140, 0x0005 },
-   { 0x2141, 0x0005 },
-   { 0x4142, 0x0005 },
-   },
-   }, {
-   14850, {
-   { 0x00a0, 0x000a },
-   { 0x20a1, 0x000a },
-   { 0x40a2, 0x000a },
-   },
-   }, {
-   ~0UL, {
-   { 0x00a0, 0x000a },
-   { 0x2001, 0x000f },
-   { 0x4002, 0x000f },
-   },
-   }
-};
-
-struct curr_ctrl {
-   unsigned long mpixelclock;
-   u16 curr[RES_MAX];
-};
-
-static const struct curr_ctrl curr_ctrl[] = {
-   /*  pixelclk bpp8bpp10   bpp12 */
-   {
-5400, { 0x091c, 0x091c, 0x06dc },
-   }, {
-5840, { 0x091c, 0x06dc, 0x06dc },
-   }, {
-7200, { 0x06dc, 0x06dc, 0x091c },
-   }, {
-7425, { 0x06dc, 0x0b5c, 0x091c },
-   }, {
-   11880, { 0x091c, 0x091c, 0x06dc },
-   }, {
-   21600, { 0x06dc, 0x0b5c, 0x091c },
-   }
-};
-
 static int hdmi_phy_configure(struct imx_hdmi *hdmi, unsigned char prep,
  unsigned char res, int cscon)
 {
unsigned res_idx, i;
u8 val, msec;
+   const struct mpll_config *mpll_config = hdmi->plat_data->mpll_cfg;
+   const struct curr_ctrl   *curr_ctrl = hdmi->plat_data->cur_ctr;
+   const struct sym_term *sym_term =  hdmi->plat_data->sym_term;
 
if (prep)
return -EINVAL;
@@ -828,7 +766,7 @@ static int hdmi_phy_configure(struct imx_hdmi *hdmi, 
unsigned char prep,
hdmi_phy_test_clear(hdmi, 0);
 
/* PLL/MPLL Cfg - always match on final entry */
-   for (i = 0; i < ARRAY_SIZE(mpll_config) - 1; i++)
+   for (i = 0; mpll_config[i].mpixelclock != (~0UL); i++)
if (hdmi->hdmi_data.video_mode.mpixelclock <=
mpll_config[i].mpixelclock)
break;
@@ -836,12 +774,12 @@ static int hdmi_phy_configure(struct imx_hdmi *hdmi, 
unsigned char prep,
hdmi_phy_i2c_write(hdmi, mpll_config[i].res[res_idx].cpce, 0x06);
hdmi_phy_i2c_write(hdmi, mpll_config[i].res[res_idx].gmp, 0x15);
 
-   for (i = 0; i < ARRAY_SIZE(curr_ctrl); i++)
+   for (i = 0; curr_ctrl[i].mpixelclock != (~0UL); i++)
if (hdmi->hdmi_data.video_mode.mpixelclock <=
curr_ctrl[i].mpixelclock)
break;
 
-   if (i >= ARRAY_SIZE(curr_ctrl)) {
+   if (curr_ctrl[i].mpixelclock == (~0UL)) {
dev_err(hdmi->dev, "Pixel clock %d - unsupported by HDMI\n",
hdmi->hdmi_data.video_mode.mpixelclock);
return -EINVAL;
@@ -852,10 +790,17 @@ static int hdmi_phy_configure(struct imx_hdmi *hdmi, 
unsigned char prep,
 
hdmi_phy_i2c_write(hdmi, 0x, 0x13);  /* PLLPHBYCTRL */
hdmi_phy_i2c_write(hdmi, 0x0006, 0x17);
+
+   for (i = 0; sym_term[i].mpixelclock != (~0UL); i++)
+   if (hdmi->hdmi_data.video_mode.mpixelclock <=
+   sym_term[i].mpixelclock)
+   break;
+
/* RESISTANCE TERM 133Ohm Cfg */
-   hdmi_phy_i2c_write(hdmi, 0x0005, 0x19);  /* TXTERM */
+   hdmi_phy_i2c_write(hdmi, sym_term[i].term, 0x19);  /* TXTERM

[PATCH v16 03/12] drm: imx: imx-hdmi: convert imx-hdmi to drm_bridge mode

2014-12-03 Thread Andy Yan
IMX6 and Rockchip RK3288 and JZ4780 (Ingenic Xburst/MIPS)
use the interface compatible Designware HDMI IP, but they
also have some lightly differences, such as phy pll configuration,
register width, 4K support, clk useage, and the crtc mux configuration
is also platform specific.

To reuse the imx hdmi driver, convert it to drm_bridge

handle encoder in imx-hdmi_pltfm.c, as most of the encoder
operation are platform specific such as crtc select and
panel format set

This patch depends on Russell King's patch:
 drm: imx: convert imx-drm to use the generic DRM OF helper
 
http://driverdev.linuxdriverproject.org/pipermail/driverdev-devel/2014-July/053484.html

Signed-off-by: Andy Yan 
Signed-off-by: Yakir Yang 

---

Changes in v16:
- use the common binding for the clocks

Changes in v15: None
Changes in v14:
- add defer probing, adviced by Philipp Zabel

Changes in v13:
- split platform specific phy configuration

Changes in v12:
- squash patch 

Changes in v11:
- squash patch  

Changes in v10:
- split generic dw_hdmi.c improvements from patch#11 (add rk3288 support)

Changes in v9: None
Changes in v8: None
Changes in v7:
- remove unused variables from structure dw_hdmi
- remove a wrong modification
- add copyrights for dw_hdmi-imx.c

Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None

 drivers/gpu/drm/imx/Makefile |   2 +-
 drivers/gpu/drm/imx/imx-hdmi.c   | 252 +--
 drivers/gpu/drm/imx/imx-hdmi.h   |  14 ++
 drivers/gpu/drm/imx/imx-hdmi_pltfm.c | 193 +++
 4 files changed, 304 insertions(+), 157 deletions(-)
 create mode 100644 drivers/gpu/drm/imx/imx-hdmi_pltfm.c

diff --git a/drivers/gpu/drm/imx/Makefile b/drivers/gpu/drm/imx/Makefile
index 582c438..63cf56a 100644
--- a/drivers/gpu/drm/imx/Makefile
+++ b/drivers/gpu/drm/imx/Makefile
@@ -9,4 +9,4 @@ obj-$(CONFIG_DRM_IMX_LDB) += imx-ldb.o
 
 imx-ipuv3-crtc-objs  := ipuv3-crtc.o ipuv3-plane.o
 obj-$(CONFIG_DRM_IMX_IPUV3)+= imx-ipuv3-crtc.o
-obj-$(CONFIG_DRM_IMX_HDMI) += imx-hdmi.o
+obj-$(CONFIG_DRM_IMX_HDMI) += imx-hdmi.o imx-hdmi_pltfm.o
diff --git a/drivers/gpu/drm/imx/imx-hdmi.c b/drivers/gpu/drm/imx/imx-hdmi.c
index 7a54d20..a7c1ec7 100644
--- a/drivers/gpu/drm/imx/imx-hdmi.c
+++ b/drivers/gpu/drm/imx/imx-hdmi.c
@@ -12,25 +12,20 @@
  * Copyright (C) 2010, Guennadi Liakhovetski 
  */
 
-#include 
 #include 
 #include 
 #include 
 #include 
 #include 
-#include 
-#include 
-#include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
 #include 
-#include 
 
 #include "imx-hdmi.h"
-#include "imx-drm.h"
 
 #define HDMI_EDID_LEN  512
 
@@ -54,11 +49,6 @@ enum hdmi_datamap {
YCbCr422_12B = 0x12,
 };
 
-enum imx_hdmi_devtype {
-   IMX6Q_HDMI,
-   IMX6DL_HDMI,
-};
-
 static const u16 csc_coeff_default[3][4] = {
{ 0x2000, 0x, 0x, 0x },
{ 0x, 0x2000, 0x, 0x },
@@ -113,7 +103,8 @@ struct hdmi_data_info {
 
 struct imx_hdmi {
struct drm_connector connector;
-   struct drm_encoder encoder;
+   struct drm_encoder *encoder;
+   struct drm_bridge *bridge;
 
enum imx_hdmi_devtype dev_type;
struct device *dev;
@@ -121,6 +112,7 @@ struct imx_hdmi {
struct clk *iahb_clk;
 
struct hdmi_data_info hdmi_data;
+   const struct imx_hdmi_plat_data *plat_data;
int vic;
 
u8 edid[HDMI_EDID_LEN];
@@ -137,13 +129,6 @@ struct imx_hdmi {
int ratio;
 };
 
-static void imx_hdmi_set_ipu_di_mux(struct imx_hdmi *hdmi, int ipu_di)
-{
-   regmap_update_bits(hdmi->regmap, IOMUXC_GPR3,
-  IMX6Q_GPR3_HDMI_MUX_CTL_MASK,
-  ipu_di << IMX6Q_GPR3_HDMI_MUX_CTL_SHIFT);
-}
-
 static inline void hdmi_writeb(struct imx_hdmi *hdmi, u8 val, int offset)
 {
writeb(val, hdmi->regs + offset);
@@ -1371,6 +1356,50 @@ static void imx_hdmi_poweroff(struct imx_hdmi *hdmi)
imx_hdmi_phy_disable(hdmi);
 }
 
+static void imx_hdmi_bridge_mode_set(struct drm_bridge *bridge,
+struct drm_display_mode *mode,
+struct drm_display_mode *adjusted_mode)
+{
+   struct imx_hdmi *hdmi = bridge->driver_private;
+
+   imx_hdmi_setup(hdmi, mode);
+
+   /* Store the display mode for plugin/DKMS poweron events */
+   memcpy(&hdmi->previous_mode, mode, sizeof(hdmi->previous_mode));
+}
+
+static bool imx_hdmi_bridge_mode_fixup(struct drm_bridge *bridge,
+  const struct drm_display_mode *mode,
+  struct drm_display_mode *adjusted_mode)
+{
+   return true;
+}
+
+static void imx_hdmi_bridge_disable(struct drm_bridge *bridge)
+{
+   struct imx_hdmi *hdmi = bridge->driver_private;
+
+   imx_hdmi_poweroff(hdmi);
+}
+
+static void imx_hdmi_bridge_enable(struct drm_bridge *bridge)
+{
+   struct imx_hdmi *hdmi = bridge->driver_private;
+
+   imx_hdmi_pow

[PATCH v16 02/12] drm: imx: imx-hdmi: return defer if can't get ddc i2c adapter

2014-12-03 Thread Andy Yan
drm driver may probe before the i2c bus, so the driver should
defer probing until it is available

Signed-off-by: Andy Yan 
Reviewed-by: Daniel Kurtz 

---

Changes in v16: None
Changes in v15: None
Changes in v14: None
Changes in v13: None
Changes in v12:
- refactor of_node_put(ddc_node)

Changes in v11: None
Changes in v10: None
Changes in v9: None
Changes in v8: None
Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4:
- defer probe ddc i2c adapter

Changes in v3: None

 drivers/gpu/drm/imx/imx-hdmi.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/imx/imx-hdmi.c b/drivers/gpu/drm/imx/imx-hdmi.c
index 7fd90ae..7a54d20 100644
--- a/drivers/gpu/drm/imx/imx-hdmi.c
+++ b/drivers/gpu/drm/imx/imx-hdmi.c
@@ -1611,10 +1611,12 @@ static int imx_hdmi_bind(struct device *dev, struct 
device *master, void *data)
ddc_node = of_parse_phandle(np, "ddc-i2c-bus", 0);
if (ddc_node) {
hdmi->ddc = of_find_i2c_adapter_by_node(ddc_node);
-   if (!hdmi->ddc)
+   of_node_put(ddc_node);
+   if (!hdmi->ddc) {
dev_dbg(hdmi->dev, "failed to read ddc node\n");
+   return -EPROBE_DEFER;
+   }
 
-   of_node_put(ddc_node);
} else {
dev_dbg(hdmi->dev, "no ddc property found\n");
}
-- 
1.9.1


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v16 01/12] drm: imx: imx-hdmi: make checkpatch happy

2014-12-03 Thread Andy Yan
CHECK: Alignment should match open parenthesis
+   if ((hdmi->vic == 10) || (hdmi->vic == 11) ||
+   (hdmi->vic == 12) || (hdmi->vic == 13) ||

CHECK: braces {} should be used on all arms of this statement
+   if (hdmi->hdmi_data.video_mode.mdvi)
[...]
+   else {
[...]

Signed-off-by: Andy Yan 
Reviewed-by: Daniel Kurtz 

---

Changes in v16: None
Changes in v15: None
Changes in v14: None
Changes in v13:
- patch against drm-next

Changes in v12: None
Changes in v11: None
Changes in v10: None
Changes in v9: None
Changes in v8: None
Changes in v7: None
Changes in v6:
- rearrange the patch order

Changes in v5: None
Changes in v4:
- fix checkpatch CHECK

Changes in v3: None

 drivers/gpu/drm/imx/imx-hdmi.c | 109 -
 1 file changed, 52 insertions(+), 57 deletions(-)

diff --git a/drivers/gpu/drm/imx/imx-hdmi.c b/drivers/gpu/drm/imx/imx-hdmi.c
index aaec6b2..7fd90ae 100644
--- a/drivers/gpu/drm/imx/imx-hdmi.c
+++ b/drivers/gpu/drm/imx/imx-hdmi.c
@@ -163,7 +163,7 @@ static void hdmi_modb(struct imx_hdmi *hdmi, u8 data, u8 
mask, unsigned reg)
 }
 
 static void hdmi_mask_writeb(struct imx_hdmi *hdmi, u8 data, unsigned int reg,
- u8 shift, u8 mask)
+u8 shift, u8 mask)
 {
hdmi_modb(hdmi, data << shift, mask, reg);
 }
@@ -327,7 +327,7 @@ static unsigned int hdmi_compute_cts(unsigned int freq, 
unsigned long pixel_clk,
 }
 
 static void hdmi_set_clk_regenerator(struct imx_hdmi *hdmi,
-   unsigned long pixel_clk)
+unsigned long pixel_clk)
 {
unsigned int clk_n, clk_cts;
 
@@ -338,7 +338,7 @@ static void hdmi_set_clk_regenerator(struct imx_hdmi *hdmi,
 
if (!clk_cts) {
dev_dbg(hdmi->dev, "%s: pixel clock not supported: %lu\n",
-__func__, pixel_clk);
+   __func__, pixel_clk);
return;
}
 
@@ -477,13 +477,11 @@ static void imx_hdmi_update_csc_coeffs(struct imx_hdmi 
*hdmi)
u16 coeff_b = (*csc_coeff)[1][i];
u16 coeff_c = (*csc_coeff)[2][i];
 
-   hdmi_writeb(hdmi, coeff_a & 0xff,
-   HDMI_CSC_COEF_A1_LSB + i * 2);
+   hdmi_writeb(hdmi, coeff_a & 0xff, HDMI_CSC_COEF_A1_LSB + i * 2);
hdmi_writeb(hdmi, coeff_a >> 8, HDMI_CSC_COEF_A1_MSB + i * 2);
hdmi_writeb(hdmi, coeff_b & 0xff, HDMI_CSC_COEF_B1_LSB + i * 2);
hdmi_writeb(hdmi, coeff_b >> 8, HDMI_CSC_COEF_B1_MSB + i * 2);
-   hdmi_writeb(hdmi, coeff_c & 0xff,
-   HDMI_CSC_COEF_C1_LSB + i * 2);
+   hdmi_writeb(hdmi, coeff_c & 0xff, HDMI_CSC_COEF_C1_LSB + i * 2);
hdmi_writeb(hdmi, coeff_c >> 8, HDMI_CSC_COEF_C1_MSB + i * 2);
}
 
@@ -535,21 +533,22 @@ static void hdmi_video_packetize(struct imx_hdmi *hdmi)
struct hdmi_data_info *hdmi_data = &hdmi->hdmi_data;
u8 val, vp_conf;
 
-   if (hdmi_data->enc_out_format == RGB
-   || hdmi_data->enc_out_format == YCBCR444) {
-   if (!hdmi_data->enc_color_depth)
+   if (hdmi_data->enc_out_format == RGB ||
+   hdmi_data->enc_out_format == YCBCR444) {
+   if (!hdmi_data->enc_color_depth) {
output_select = HDMI_VP_CONF_OUTPUT_SELECTOR_BYPASS;
-   else if (hdmi_data->enc_color_depth == 8) {
+   } else if (hdmi_data->enc_color_depth == 8) {
color_depth = 4;
output_select = HDMI_VP_CONF_OUTPUT_SELECTOR_BYPASS;
-   } else if (hdmi_data->enc_color_depth == 10)
+   } else if (hdmi_data->enc_color_depth == 10) {
color_depth = 5;
-   else if (hdmi_data->enc_color_depth == 12)
+   } else if (hdmi_data->enc_color_depth == 12) {
color_depth = 6;
-   else if (hdmi_data->enc_color_depth == 16)
+   } else if (hdmi_data->enc_color_depth == 16) {
color_depth = 7;
-   else
+   } else {
return;
+   }
} else if (hdmi_data->enc_out_format == YCBCR422_8BITS) {
if (!hdmi_data->enc_color_depth ||
hdmi_data->enc_color_depth == 8)
@@ -561,8 +560,9 @@ static void hdmi_video_packetize(struct imx_hdmi *hdmi)
else
return;
output_select = HDMI_VP_CONF_OUTPUT_SELECTOR_YCC422;
-   } else
+   } else {
return;
+   }
 
/* set the packetizer registers */
val = ((color_depth << HDMI_VP_PR_CD_COLOR_DEPTH_OFFSET) &
@@ -623,34 +623,34 @@ static void hdmi_video_packetize(struct imx_hdmi *hdmi)
 }
 
 static inline void hdmi_phy_test_clear(struct imx_hdmi *hdmi,
-   unsigned char bit)
+

[PATCH v16 0/12] dw-hdmi: convert imx hdmi to bridge/dw_hdmi

2014-12-03 Thread Andy Yan

We found Freescale imx6 and Rockchip rk3288 and Ingenic JZ4780 (Xburst/MIPS)
use the interface compatible Designware HDMI IP, but they also have some
lightly differences, such as phy pll configuration, register width(imx hdmi
register is one byte, but rk3288 is 4 bytes width and can only be accessed
by word), 4K support(imx6 doesn't support 4k, but rk3288 does), and HDMI2.0
support.

To reuse the imx-hdmi driver, we make this patch set:
(1): fix some CodingStyle warning to make checkpatch happy
(2): convert imx-hdmi to drm_bridge
(3): split platform specific code
(4): move imx-hdmi to bridge/dw_hdmi
(5): extend dw_hdmi.c to support rk3288 hdmi
(6): add rockchip rk3288 platform specific code dw_hdmi-rockchip.c

Changes in v16:
- use the common binding for the clocks
- describe ddc-i2c-bus as optional

Changes in v15:
- add prefix dw_hdmi/DW_HDMI for public used dw_hdmi structs
  adviced by Philipp Zabel
- remove THIS_MODULE in platform driver
- remove unio of the multi-byte register access, adviced by Philipp Zabel
- remove THIS_MODULE in platform driver

Changes in v14:
- add defer probing, adviced by Philipp Zabel
- remove drm_connector_register, because imx-drm core has registered
connector

Changes in v13:
- patch against drm-next
- split platform specific phy configuration
- split phy configuration from patch#4

Changes in v12:
- refactor of_node_put(ddc_node)
- squash patch 
- add comment for the depend on patch

Changes in v11:
- squash patch  

Changes in v10:
- split generic dw_hdmi.c improvements from patch#11 (add rk3288 support)
- add more display mode support mpll configuration for rk3288

Changes in v9:
- move some phy configuration to platform driver

Changes in v8:
- correct some spelling mistake
- modify ddc-i2c-bus and interrupt description
- Add documentation for rockchip dw hdmi

Changes in v7:
- remove unused variables from structure dw_hdmi
- remove a wrong modification
- add copyrights for dw_hdmi-imx.c

Changes in v6:
- rearrange the patch order
- refactor register access without reg_shift

Changes in v5:
- refactor reg-io-width

Changes in v4:
- fix checkpatch CHECK
- defer probe ddc i2c adapter

Changes in v3:
- split multi-register access to one indepent patch

Andy Yan (12):
  drm: imx: imx-hdmi: make checkpatch happy
  drm: imx: imx-hdmi: return defer if can't get ddc i2c adapter
  drm: imx: imx-hdmi: convert imx-hdmi to drm_bridge mode
  drm: imx: imx-hdmi: split phy configuration to platform driver
  drm: imx: imx-hdmi: move imx-hdmi to bridge/dw_hdmi
  dt-bindings: add document for dw_hdmi
  drm: bridge/dw_hdmi: add support for multi-byte register width access
  drm: bridge/dw_hdmi: add mode_valid support
  drm: bridge/dw_hdmi: clear i2cmphy_stat0 reg in hdmi_phy_wait_i2c_done
  drm: bridge/dw_hdmi: add function dw_hdmi_phy_enable_spare
  dt-bindings: Add documentation for rockchip dw hdmi
  drm: bridge/dw_hdmi: add rockchip rk3288 support

 .../devicetree/bindings/drm/bridge/dw_hdmi.txt |  45 ++
 .../devicetree/bindings/video/dw_hdmi-rockchip.txt |  46 ++
 drivers/gpu/drm/bridge/Kconfig |   5 +
 drivers/gpu/drm/bridge/Makefile|   1 +
 .../gpu/drm/{imx/imx-hdmi.c => bridge/dw_hdmi.c}   | 711 ++---
 .../gpu/drm/{imx/imx-hdmi.h => bridge/dw_hdmi.h}   |   4 +-
 drivers/gpu/drm/imx/Kconfig|   1 +
 drivers/gpu/drm/imx/Makefile   |   2 +-
 drivers/gpu/drm/imx/dw_hdmi-imx.c  | 247 +++
 drivers/gpu/drm/rockchip/Kconfig   |  10 +
 drivers/gpu/drm/rockchip/Makefile  |   2 +
 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c| 321 ++
 include/drm/bridge/dw_hdmi.h   |  60 ++
 13 files changed, 1074 insertions(+), 381 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt
 create mode 100644 Documentation/devicetree/bindings/video/dw_hdmi-rockchip.txt
 rename drivers/gpu/drm/{imx/imx-hdmi.c => bridge/dw_hdmi.c} (73%)
 rename drivers/gpu/drm/{imx/imx-hdmi.h => bridge/dw_hdmi.h} (99%)
 create mode 100644 drivers/gpu/drm/imx/dw_hdmi-imx.c
 create mode 100644 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
 create mode 100644 include/drm/bridge/dw_hdmi.h

-- 
1.9.1


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Staging: slicoss: Fix long line issues in slicoss.c

2014-12-03 Thread Sean Cleator
A patch to the slicoss.c file to fix some of the long line issues found by the
checkpath.pl tool
 
Signed-off-by: Sean Cleator 

---
 drivers/staging/slicoss/slicoss.c | 39 ++-
 1 file changed, 26 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/slicoss/slicoss.c 
b/drivers/staging/slicoss/slicoss.c
index 56ca3b6..4df4a7e 100644
--- a/drivers/staging/slicoss/slicoss.c
+++ b/drivers/staging/slicoss/slicoss.c
@@ -498,12 +498,14 @@ static int slic_card_download(struct adapter *adapter)
slic_reg32_write(&slic_regs->slic_wcs,
 baseaddress + codeaddr, FLUSH);
/* Write out instruction to low addr */
-   slic_reg32_write(&slic_regs->slic_wcs, instruction, 
FLUSH);
+   slic_reg32_write(&slic_regs->slic_wcs,
+   instruction, FLUSH);
instruction = *(u32 *)(fw->data + index);
index += 4;
 
/* Write out instruction to high addr */
-   slic_reg32_write(&slic_regs->slic_wcs, instruction, 
FLUSH);
+   slic_reg32_write(&slic_regs->slic_wcs,
+   instruction, FLUSH);
instruction = *(u32 *)(fw->data + index);
index += 4;
}
@@ -1533,14 +1535,18 @@ retry_rcvqfill:
dev_err(dev, "%s: LOW 32bits PHYSICAL ADDRESS 
== 0\n",
__func__);
dev_err(dev, "skb[%p] PROBLEM\n", skb);
-   dev_err(dev, " skbdata[%p]\n", 
skb->data);
+   dev_err(dev, " skbdata[%p]\n",
+   skb->data);
dev_err(dev, " skblen[%x]\n", skb->len);
dev_err(dev, " paddr[%p]\n", paddr);
dev_err(dev, " paddrl[%x]\n", paddrl);
dev_err(dev, " paddrh[%x]\n", paddrh);
-   dev_err(dev, " rcvq->head[%p]\n", 
rcvq->head);
-   dev_err(dev, " rcvq->tail[%p]\n", 
rcvq->tail);
-   dev_err(dev, " rcvq->count[%x]\n", 
rcvq->count);
+   dev_err(dev, " rcvq->head[%p]\n",
+   rcvq->head);
+   dev_err(dev, " rcvq->tail[%p]\n",
+   rcvq->tail);
+   dev_err(dev, " rcvq->count[%x]\n",
+   rcvq->count);
dev_err(dev, "SKIP THIS SKB\n");
goto retry_rcvqfill;
}
@@ -1549,14 +1555,18 @@ retry_rcvqfill:
dev_err(dev, "%s: LOW 32bits PHYSICAL ADDRESS 
== 0\n",
__func__);
dev_err(dev, "skb[%p] PROBLEM\n", skb);
-   dev_err(dev, " skbdata[%p]\n", 
skb->data);
+   dev_err(dev, " skbdata[%p]\n",
+   skb->data);
dev_err(dev, " skblen[%x]\n", skb->len);
dev_err(dev, " paddr[%p]\n", paddr);
dev_err(dev, " paddrl[%x]\n", paddrl);
dev_err(dev, " paddrh[%x]\n", paddrh);
-   dev_err(dev, " rcvq->head[%p]\n", 
rcvq->head);
-   dev_err(dev, " rcvq->tail[%p]\n", 
rcvq->tail);
-   dev_err(dev, " rcvq->count[%x]\n", 
rcvq->count);
+   dev_err(dev, " rcvq->head[%p]\n",
+   rcvq->head);
+   dev_err(dev, " rcvq->tail[%p]\n",
+   rcvq->tail);
+   dev_err(dev, " rcvq->count[%x]\n",
+   rcvq->count);
dev_err(dev, "GIVE TO CARD ANYWAY\n");
}
 #endif
@@ -1885,7 +1895,8 @@ static void slic_xmit_fail(struct adapter *adapter,
break;
case XMIT_FAIL_HOSTCMD_FAIL:
dev_err(&adapter->netdev->dev,
-   "xmit_start skb[%p] type[%x] No host commands 
available\n", skb, skb->pkt_type);
+   "xmit_start skb[%p] type[%x] No host c

Re: [PATCH v15 12/12] drm: bridge/dw_hdmi: add rockchip rk3288 support

2014-12-03 Thread Andy Yan

Hi Philipp:
On 2014年12月03日 21:09, Philipp Zabel wrote:

Hi Andy,

Am Mittwoch, den 03.12.2014, 20:32 +0800 schrieb Andy Yan:

My question is not about the available gates at the SoC level, but about
the actual clock inputs from point of view of the HDMI TX IP.

It could be that the hdmi_ctrl_clk gates all inputs to the module and
bus clocks together. If so, you could just reuse "isfr" and "iahb" and
set it to the same clock. If not, we'd need to think of something else.
Unfortunately I don't have any Synopsys documentation of the HDMI TX at
that level.

 After confirming with the IC designer, we finally make clear that
 Rockchip RK3288 almost use the same clock design with imx:
 clk-iahbclk, used for hdmi module and bus
 hdcp_clk-isfrclk, used for hdcp and i2cm
 cecclk -cecclk, but this clk can be gated on rockchip, this is
different with imx,
 but we don't handle the cec stuff now. So i will try to reuse the
imx clk binds. do you
think that is ok?

Thank you for taking the time to verify this. So we should move the
clock handling out of the soc specific parts into the common driver and
reuse the existing clock bindings ("iahb", "isfr").
I'd suggest to add the "cec" clock now to the binding document as an
optional clock, then you can already specify it in the rockchip dtsi.

  ok


regards
Philipp





___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v15 12/12] drm: bridge/dw_hdmi: add rockchip rk3288 support

2014-12-03 Thread Philipp Zabel
Hi Andy,

Am Mittwoch, den 03.12.2014, 20:32 +0800 schrieb Andy Yan:
> > My question is not about the available gates at the SoC level, but about
> > the actual clock inputs from point of view of the HDMI TX IP.
> >
> > It could be that the hdmi_ctrl_clk gates all inputs to the module and
> > bus clocks together. If so, you could just reuse "isfr" and "iahb" and
> > set it to the same clock. If not, we'd need to think of something else.
> > Unfortunately I don't have any Synopsys documentation of the HDMI TX at
> > that level.
> 
> After confirming with the IC designer, we finally make clear that
> Rockchip RK3288 almost use the same clock design with imx:
> clk-iahbclk, used for hdmi module and bus
> hdcp_clk-isfrclk, used for hdcp and i2cm
> cecclk -cecclk, but this clk can be gated on rockchip, this is 
> different with imx,
> but we don't handle the cec stuff now. So i will try to reuse the 
> imx clk binds. do you
>think that is ok?

Thank you for taking the time to verify this. So we should move the
clock handling out of the soc specific parts into the common driver and
reuse the existing clock bindings ("iahb", "isfr").
I'd suggest to add the "cec" clock now to the binding document as an
optional clock, then you can already specify it in the rockchip dtsi.

regards
Philipp

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v15 12/12] drm: bridge/dw_hdmi: add rockchip rk3288 support

2014-12-03 Thread Andy Yan

Hi Philipp:
On 2014年12月02日 21:00, Philipp Zabel wrote:

Hi Andy,

Am Dienstag, den 02.12.2014, 20:34 +0800 schrieb Andy Yan:

Hi Philipp:
On 2014年12月02日 18:24, Philipp Zabel wrote:

Hi Andy,

Am Dienstag, den 02.12.2014, 15:45 +0800 schrieb Andy Yan:
[...]

+static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master,
+void *data)
+{
+   struct platform_device *pdev = to_platform_device(dev);
+   const struct dw_hdmi_plat_data *plat_data;
+   const struct of_device_id *match;
+   struct drm_device *drm = data;
+   struct drm_encoder *encoder;
+   struct rockchip_hdmi *hdmi;
+   int ret;
+
+   if (!pdev->dev.of_node)
+   return -ENODEV;
+
+   hdmi = devm_kzalloc(&pdev->dev, sizeof(*hdmi), GFP_KERNEL);
+   if (!hdmi)
+   return -ENOMEM;
+
+   match = of_match_node(dw_hdmi_rockchip_ids, pdev->dev.of_node);
+   plat_data = match->data;
+   hdmi->dev = &pdev->dev;
+   encoder = &hdmi->encoder;
+   platform_set_drvdata(pdev, hdmi);
+
+   ret = rockchip_hdmi_parse_dt(hdmi);
+   if (ret) {
+   dev_err(hdmi->dev, "Unable to parse OF data\n");
+   return ret;
+   }
+
+   ret = clk_prepare_enable(hdmi->clk);
+   if (ret) {
+   dev_err(hdmi->dev, "Cannot enable HDMI clock: %d\n", ret);
+   return ret;
+   }
+
+   ret = clk_prepare_enable(hdmi->hdcp_clk);
+   if (ret) {
+   dev_err(hdmi->dev, "Cannot enable HDMI hdcp clock: %d\n", ret);
+   return ret;
+   }

Could we have a look at the clocks again? Basically the Rockchip clock
handling is exactly the same, except the clocks are called by other
names.

On i.MX6, according to the reference manual, the HDMI TX module has four
clock inputs: "iahbclk" (bus clock), "icecclk" (32 kHz CEC clock),
"ihclk" (module clock), and "isfrclk" (27 MHz internal SFR clock).
The "iahbclk" and "ihclk" are both sourced from the SoC AHB root clock,
the 32 kHz reference input can't be gated, and the "isfrclk" has its own
gate.

Does the HDMI TX implementation on Rockchip still have the separate
external sfr bus and module clock inputs? I assume that your "clk" input
is a single gate bit for bus and module clocks at the same time?
If possible, I'd prefer to find a common binding for the clocks with
some of the clocks being optional, but for that we need to know the
actual clock inputs to the HDMI TX module.

regards
Philipp


  There are three  individual clock inputs on Rockchip RK3288 HDMI:
"hdmi_ctrl_clk",
  "hdmi_cec_clk", "hdmi_hdcp_clk", the three clocks are responsible
for different
   functions as their name described, and have their own private gate
bit. That is
   to say, the cec_clk and hdcp_clk can all be disabled if we don't
need hdcp and cec
   function.
   So I think it's better to make the clk control platform independent.

My question is not about the available gates at the SoC level, but about
the actual clock inputs from point of view of the HDMI TX IP.

It could be that the hdmi_ctrl_clk gates all inputs to the module and
bus clocks together. If so, you could just reuse "isfr" and "iahb" and
set it to the same clock. If not, we'd need to think of something else.
Unfortunately I don't have any Synopsys documentation of the HDMI TX at
that level.


   After confirming with the IC designer, we finally make clear that
   Rockchip RK3288 almost use the same clock design with imx:
   clk-iahbclk, used for hdmi module and bus
   hdcp_clk-isfrclk, used for hdcp and i2cm
   cecclk -cecclk, but this clk can be gated on rockchip, this is 
different with imx,
   but we don't handle the cec stuff now. So i will try to reuse the 
imx clk binds. do you

  think that is ok?

regards
Philipp







___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v15 06/12] dt-bindings: add document for dw_hdmi

2014-12-03 Thread Andy Yan


On 2014年12月03日 19:52, Philipp Zabel wrote:

Am Mittwoch, den 03.12.2014, 17:46 +0800 schrieb Andy Yan:

On 2014年12月03日 02:23, Philipp Zabel wrote:

Hi Andy,

Am Dienstag, den 02.12.2014, 15:42 +0800 schrieb Andy Yan:

diff --git a/Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt 
b/Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt
new file mode 100644
index 000..107c1ca
--- /dev/null
+++ b/Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt
@@ -0,0 +1,40 @@
+DesignWare HDMI bridge bindings
+
+Required properities:
+- compatible: platform specific such as:
+   * "fsl,imx6q-hdmi"
+   * "fsl,imx6dl-hdmi"
+   * "rockchip,rk3288-dw-hdmi"

I think we should add a common compatible value "snps,dw-hdmi-tx" here:

compatible = "fsl,imx6q-hdmi", "snps,dw-hdmi-tx";


+- reg: Physical base address and length of the controller's registers.
+- ddc-i2c-bus: phandle of an I2C controller used for DDC EDID probing

Better make ddc-i2c-bus optional, see the other thread about the ddc i2c
master.

  I have the same idea too, but the patch about ddc i2c master has not
   landed yet,  can we change the ddc-i2c-bus to optional  after the ddc
i2c master
   patch land?

Check out Documentation/devicetree/bindings/drm/imx/hdmi.txt, it was
already marked as optional. We can't make it required now.

regards
Philipp




  OK, got it, thanks

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v15 06/12] dt-bindings: add document for dw_hdmi

2014-12-03 Thread Philipp Zabel
Am Mittwoch, den 03.12.2014, 17:46 +0800 schrieb Andy Yan:
> On 2014年12月03日 02:23, Philipp Zabel wrote:
> > Hi Andy,
> >
> > Am Dienstag, den 02.12.2014, 15:42 +0800 schrieb Andy Yan:
> >> diff --git a/Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt 
> >> b/Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt
> >> new file mode 100644
> >> index 000..107c1ca
> >> --- /dev/null
> >> +++ b/Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt
> >> @@ -0,0 +1,40 @@
> >> +DesignWare HDMI bridge bindings
> >> +
> >> +Required properities:
> >> +- compatible: platform specific such as:
> >> +   * "fsl,imx6q-hdmi"
> >> +   * "fsl,imx6dl-hdmi"
> >> +   * "rockchip,rk3288-dw-hdmi"
> > I think we should add a common compatible value "snps,dw-hdmi-tx" here:
> >
> > compatible = "fsl,imx6q-hdmi", "snps,dw-hdmi-tx";
> >
> >> +- reg: Physical base address and length of the controller's registers.
> >> +- ddc-i2c-bus: phandle of an I2C controller used for DDC EDID probing
> > Better make ddc-i2c-bus optional, see the other thread about the ddc i2c
> > master.
>  I have the same idea too, but the patch about ddc i2c master has not
>   landed yet,  can we change the ddc-i2c-bus to optional  after the ddc 
> i2c master
>   patch land?

Check out Documentation/devicetree/bindings/drm/imx/hdmi.txt, it was
already marked as optional. We can't make it required now.

regards
Philipp

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 01/11] staging: comedi: hwdrv_apci1500: introduce z8536_read()

2014-12-03 Thread Ian Abbott

On 02/12/14 17:19, H Hartley Sweeten wrote:

The Z8536 CIO registers are indirectly read by writing the register value
to the control register then reading the control register. Introduce a helper
function to read the Z8536 CIO registers.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
  .../comedi/drivers/addi-data/hwdrv_apci1500.c  | 216 +
  1 file changed, 52 insertions(+), 164 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c 
b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
index bfa9228..5d4d35b 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
@@ -129,6 +129,14 @@ static int i_InputChannel;
  static int i_TimerCounter1Enabled, i_TimerCounter2Enabled,
   i_WatchdogCounter3Enabled;

+static unsigned int z8536_read(struct comedi_device *dev, unsigned int reg)
+{
+   struct apci1500_private *devpriv = dev->private;
+
+   outb(reg, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
+   return inb(devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
+}
+


Since this is used by both the interrupt handler and "normal" code, it 
should use a spin-lock (e.g. dev->spinlock could be used).  That also 
applies to z8536_write() in patch 2 and probably the "reset" sequence at 
the start of z8536_reset() in patch 3.


--
-=( Ian Abbott @ MEV Ltd.E-mail:  )=-
-=(  Web: http://www.mev.co.uk/  )=-
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 01/11] staging: comedi: hwdrv_apci1500: introduce z8536_read()

2014-12-03 Thread Ian Abbott

On 02/12/14 17:19, H Hartley Sweeten wrote:

The Z8536 CIO registers are indirectly read by writing the register value


I think you mean the register offset.  (That also applies to patch 2.)


to the control register then reading the control register. Introduce a helper
function to read the Z8536 CIO registers.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
  .../comedi/drivers/addi-data/hwdrv_apci1500.c  | 216 +
  1 file changed, 52 insertions(+), 164 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c 
b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
index bfa9228..5d4d35b 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
@@ -129,6 +129,14 @@ static int i_InputChannel;
  static int i_TimerCounter1Enabled, i_TimerCounter2Enabled,
   i_WatchdogCounter3Enabled;

+static unsigned int z8536_read(struct comedi_device *dev, unsigned int reg)
+{
+   struct apci1500_private *devpriv = dev->private;
+
+   outb(reg, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
+   return inb(devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
+}
+
  /*
   * An event can be generated for each port. The first event is related to the
   * first 8 channels (port 1) and the second to the following 6 channels (port 
2)
@@ -311,14 +319,8 @@ static int apci1500_di_config(struct comedi_device *dev,
devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER);

-   /* Selects the mode specification mask*/
-   /* register of port 1 */
-   outb(APCI1500_RW_PORT_A_SPECIFICATION,
-   devpriv->iobase +
-   APCI1500_Z8536_CONTROL_REGISTER);
-   i_RegValue =
-   inb(devpriv->iobase +
-   APCI1500_Z8536_CONTROL_REGISTER);
+   i_RegValue = z8536_read(dev,
+   APCI1500_RW_PORT_A_SPECIFICATION);

/* Selects the mode specification mask*/
/* register of port 1 */
@@ -366,14 +368,8 @@ static int apci1500_di_config(struct comedi_device *dev,
outb(0x74,
devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER);
-   /* Selects the mode specification mask  */
-   /* register of port B   */
-   outb(APCI1500_RW_PORT_B_SPECIFICATION,
-   devpriv->iobase +
-   APCI1500_Z8536_CONTROL_REGISTER);
-   i_RegValue =
-   inb(devpriv->iobase +
-   APCI1500_Z8536_CONTROL_REGISTER);
+   i_RegValue = z8536_read(dev,
+   APCI1500_RW_PORT_B_SPECIFICATION);

/* Selects the mode specification mask*/
/* register of port B */
@@ -416,14 +412,8 @@ static int apci1500_di_config(struct comedi_device *dev,
devpriv->iobase +
APCI1500_Z8536_CONTROL_REGISTER);

-   /* Selects the mode specification mask*/
-   /* register of port 2 */
-   outb(APCI1500_RW_PORT_B_SPECIFICATION,
-   devpriv->iobase +
-   APCI1500_Z8536_CONTROL_REGISTER);
-   i_RegValue =
-   inb(devpriv->iobase +
-   APCI1500_Z8536_CONTROL_REGISTER);
+   i_RegValue = z8536_read(dev,
+   APCI1500_RW_PORT_B_SPECIFICATION);
/* Selects the mode specification mask*/
/* register of port 2 */
outb(APCI1500_RW_PORT_B_SPECIFICATION,
@@ -500,12 +490,8 @@ static int apci1500_di_write(struct comedi_device *dev,
devpriv->iobase +

APCI1500_Z8536_CONTROL_REGISTER);
i_Event1InterruptStatus = 1;
-   outb(APCI1500_RW_PORT_A_SPECIFICATION,
-   devpriv->iobase +
-   
APCI1500_Z8536_CONTROL_REGISTER);
-   i_RegValue =
-   inb(devpriv->iobase +
-   

Re: [PATCH v15 06/12] dt-bindings: add document for dw_hdmi

2014-12-03 Thread Andy Yan


On 2014年12月03日 02:23, Philipp Zabel wrote:

Hi Andy,

Am Dienstag, den 02.12.2014, 15:42 +0800 schrieb Andy Yan:

diff --git a/Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt 
b/Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt
new file mode 100644
index 000..107c1ca
--- /dev/null
+++ b/Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt
@@ -0,0 +1,40 @@
+DesignWare HDMI bridge bindings
+
+Required properities:
+- compatible: platform specific such as:
+   * "fsl,imx6q-hdmi"
+   * "fsl,imx6dl-hdmi"
+   * "rockchip,rk3288-dw-hdmi"

I think we should add a common compatible value "snps,dw-hdmi-tx" here:

compatible = "fsl,imx6q-hdmi", "snps,dw-hdmi-tx";


+- reg: Physical base address and length of the controller's registers.
+- ddc-i2c-bus: phandle of an I2C controller used for DDC EDID probing

Better make ddc-i2c-bus optional, see the other thread about the ddc i2c
master.

I have the same idea too, but the patch about ddc i2c master has not
 landed yet,  can we change the ddc-i2c-bus to optional  after the ddc 
i2c master

 patch land?

+- interrupts: The HDMI interrupt number
+
+Optional properties
+- reg-io-width: the width of the reg:1,4, default set to 1 if not present
+
+Example:
+   hdmi: hdmi@012 {
+   compatible = "fsl,imx6q-hdmi";
+   reg = <0x0012 0x9000>;
+   interrupts = <0 115 0x04>;
+   gpr = <&gpr>;
+   clocks = <&clks 123>, <&clks 124>;
+   clock-names = "iahb", "isfr";
+   ddc-i2c-bus = <&i2c2>;
+
+   port@0 {
+   reg = <0>;
+
+   hdmi_mux_0: endpoint {
+   remote-endpoint = <&ipu1_di0_hdmi>;
+   };
+   };
+
+   port@1 {
+   reg = <1>;
+
+   hdmi_mux_1: endpoint {
+   remote-endpoint = <&ipu1_di1_hdmi>;
+   };
+   };
+   };

regards
Philipp


___
Linux-rockchip mailing list
linux-rockc...@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip






___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v15 06/12] dt-bindings: add document for dw_hdmi

2014-12-03 Thread Andy Yan

Hi Philipp:
On 2014年12月03日 17:19, Philipp Zabel wrote:

Hi Andy,

Am Mittwoch, den 03.12.2014, 08:54 +0800 schrieb Andy Yan:

+Required properities:
+- compatible: platform specific such as:
+   * "fsl,imx6q-hdmi"
+   * "fsl,imx6dl-hdmi"
+   * "rockchip,rk3288-dw-hdmi"

I think we should add a common compatible value "snps,dw-hdmi-tx" here:

compatible = "fsl,imx6q-hdmi", "snps,dw-hdmi-tx";


   How about "snps,dw-hdmi", because the driver is not only about
hdmi tx, but also include hdmi phy.

Synopsys call the whole module
"DesignWare HDMI Transmitter (TX) IP Solution":

https://www.synopsys.com/dw/ipdir.php?ds=dwc_hdmi_14_csds_tx
https://www.synopsys.com/dw/ipdir.php?ds=dwc_hdmi_20_csds_tx

That includes the PHY. I'd prefer keeping the -tx in there to
differentiate from a possible future "snps,dw-hdmi-rx":

https://www.synopsys.com/dw/ipdir.php?ds=dwc_hdmi_14_csds_rx
https://www.synopsys.com/dw/ipdir.php?ds=dwc_hdmi_20_csds_rx


  Ok, I will add the compatible "snps, dw-hdmi-tx",
   So do I need to add this value to imx6dl.dtsi?

If we add such compatible value, do we have to implement another
 platform driver like dw_hdmi-pltfm.c with the
compatible="snps,dw-hdmi" ,
 or just include the compatible value in dw_hdmi-imx.c and
dw_hdmi-rockchip.c?

That common compatible doesn't have to be used by any driver. It's just
there to show these are the same/similar IP core.
If a common driver without any SoC specific knowledge could be written,
that one would match against the common compatible.

regards
Philipp


___
Linux-rockchip mailing list
linux-rockc...@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip






___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v15 06/12] dt-bindings: add document for dw_hdmi

2014-12-03 Thread Philipp Zabel
Hi Andy,

Am Mittwoch, den 03.12.2014, 08:54 +0800 schrieb Andy Yan:
> >> +Required properities:
> >> +- compatible: platform specific such as:
> >> +   * "fsl,imx6q-hdmi"
> >> +   * "fsl,imx6dl-hdmi"
> >> +   * "rockchip,rk3288-dw-hdmi"
> > I think we should add a common compatible value "snps,dw-hdmi-tx" here:
> >
> > compatible = "fsl,imx6q-hdmi", "snps,dw-hdmi-tx";
> >
>   How about "snps,dw-hdmi", because the driver is not only about
>hdmi tx, but also include hdmi phy.

Synopsys call the whole module
"DesignWare HDMI Transmitter (TX) IP Solution":

https://www.synopsys.com/dw/ipdir.php?ds=dwc_hdmi_14_csds_tx
https://www.synopsys.com/dw/ipdir.php?ds=dwc_hdmi_20_csds_tx

That includes the PHY. I'd prefer keeping the -tx in there to
differentiate from a possible future "snps,dw-hdmi-rx":

https://www.synopsys.com/dw/ipdir.php?ds=dwc_hdmi_14_csds_rx
https://www.synopsys.com/dw/ipdir.php?ds=dwc_hdmi_20_csds_rx

>If we add such compatible value, do we have to implement another
> platform driver like dw_hdmi-pltfm.c with the 
> compatible="snps,dw-hdmi" ,
> or just include the compatible value in dw_hdmi-imx.c and 
> dw_hdmi-rockchip.c?

That common compatible doesn't have to be used by any driver. It's just
there to show these are the same/similar IP core.
If a common driver without any SoC specific knowledge could be written,
that one would match against the common compatible.

regards
Philipp

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2] staging: rt8192u: fix sparse warnings in r8192U_core.c

2014-12-03 Thread Sudip Mukherjee
On Wed, Dec 03, 2014 at 02:30:29PM +0800, Fred Chou wrote:
> From: Fred Chou 
> 
> v2: alignment to match open parenthesis

this should not come in commit log, this should go as a comment below the ---

and this patch is not applying to next-20141201, maybe in staging-testing

> 
> Fixed the following warnings in sparse:
> drivers/staging/rtl8192u/r8192U_core.c:670:6: warning:
>   symbol 'dump_eprom' was not declared.
>   Should it be static?
> drivers/staging/rtl8192u/r8192U_core.c:1489:5: warning:
>   symbol 'ComputeTxTime' was not declared.
>   Should it be static?
> drivers/staging/rtl8192u/r8192U_core.c:1556:14: warning:
>   symbol 'txqueue2outpipe' was not declared.
>   Should it be static?
> drivers/staging/rtl8192u/r8192U_core.c:4876:5: warning:
>   symbol 'GetRxPacketShiftBytes819xUsb' was not declared.
>   Should it be static?
> 
> Signed-off-by: Fred Chou 
> ---
>  drivers/staging/rtl8192u/r8192U_core.c | 10 ++
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/rtl8192u/r8192U_core.c 
> b/drivers/staging/rtl8192u/r8192U_core.c
> index 7640386..6b647ad 100644
> --- a/drivers/staging/rtl8192u/r8192U_core.c
> +++ b/drivers/staging/rtl8192u/r8192U_core.c
> @@ -667,7 +667,7 @@ static void tx_timeout(struct net_device *dev)
>  
>  
>  /* this is only for debug */
> -void dump_eprom(struct net_device *dev)
> +static void dump_eprom(struct net_device *dev)
>  {
>   int i;
>   for (i = 0; i < 63; i++)
> @@ -1486,7 +1486,7 @@ inline u8 rtl8192_IsWirelessBMode(u16 rate)
>  
>  u16 N_DBPSOfRate(u16 DataRate);
>  
> -u16 ComputeTxTime(u16 FrameLength, u16 DataRate, u8 bManagementFrame,
> +static u16 ComputeTxTime(u16 FrameLength, u16 DataRate, u8 bManagementFrame,
> u8 bShortPreamble)
u missed this alignment

thanks
sudip
>  {
>   u16 FrameTime;
> @@ -1553,7 +1553,8 @@ u16 N_DBPSOfRate(u16 DataRate)
>   return N_DBPS;
>  }
>  
> -unsigned int txqueue2outpipe(struct r8192_priv *priv, unsigned int tx_queue)
> +static unsigned int txqueue2outpipe(struct r8192_priv *priv,
> +  unsigned int tx_queue)
>  {
>   if (tx_queue >= 9) {
>   RT_TRACE(COMP_ERR, "%s():Unknown queue ID!!!\n", __func__);
> @@ -4873,7 +4874,8 @@ static void query_rxdesc_status(struct sk_buff *skb,
>  
>  }
>  
> -u32 GetRxPacketShiftBytes819xUsb(struct ieee80211_rx_stats  *Status, bool 
> bIsRxAggrSubframe)
> +static u32 GetRxPacketShiftBytes819xUsb(struct ieee80211_rx_stats  *Status,
> +  bool bIsRxAggrSubframe)
>  {
>  #ifdef USB_RX_AGGREGATION_SUPPORT
>   if (bIsRxAggrSubframe)
> -- 
> 1.9.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: Possible memory leak in function (reserve_range) not freeing pointer (regionid)

2014-12-03 Thread Dan Carpenter
This is a real bug, but it's very minor.  To trigger it, you would have
to modprobe and rmmod many many times in a loop.  If you report these
sorts of minor bugs when the code is new, then most times people fix
them but this one is old I doubt anyone is motivated to fix it.  Fixing
it seems a little complicated to me as well.

I suppose that linux-ker...@vger.kernel.org is the correct mailing list
to report this but the truth is that no one reads that list.

Anyway, it seems that you have written a good bug finding tool.  :)
Congratulations for that!

regards,
dan carpenter
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: dgnc: fix long lines

2014-12-03 Thread Krzysztof Adamski
This patch fixes checkpatch complains about lines over 80 characters.

No code was modified, only whitespace changes and comments editing.

Signed-off-by: Krzysztof Adamski 
---
 drivers/staging/dgnc/dgnc_cls.h|  24 ++---
 drivers/staging/dgnc/dgnc_driver.c |  50 +
 drivers/staging/dgnc/dgnc_driver.h |  55 +-
 drivers/staging/dgnc/dgnc_mgmt.c   |   3 +-
 drivers/staging/dgnc/dgnc_neo.c| 203 +
 drivers/staging/dgnc/dgnc_neo.h|  54 +-
 drivers/staging/dgnc/dgnc_sysfs.c  | 129 ---
 7 files changed, 311 insertions(+), 207 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_cls.h b/drivers/staging/dgnc/dgnc_cls.h
index 465d79a..cb84c99 100644
--- a/drivers/staging/dgnc/dgnc_cls.h
+++ b/drivers/staging/dgnc/dgnc_cls.h
@@ -36,14 +36,14 @@
  /
 
 struct cls_uart_struct {
-   u8 txrx;/* WR  RHR/THR - Holding Reg */
-   u8 ier; /* WR  IER - Interrupt Enable Reg */
-   u8 isr_fcr; /* WR  ISR/FCR - Interrupt Status Reg/Fifo 
Control Reg */
-   u8 lcr; /* WR  LCR - Line Control Reg */
-   u8 mcr; /* WR  MCR - Modem Control Reg */
-   u8 lsr; /* WR  LSR - Line Status Reg */
-   u8 msr; /* WR  MSR - Modem Status Reg */
-   u8 spr; /* WR  SPR - Scratch Pad Reg */
+   u8 txrx;/* WR RHR/THR - Holding Reg */
+   u8 ier; /* WR IER - Interrupt Enable Reg */
+   u8 isr_fcr; /* WR ISR/FCR - Interrupt Status Reg/Fifo Control Reg */
+   u8 lcr; /* WR LCR - Line Control Reg */
+   u8 mcr; /* WR MCR - Modem Control Reg */
+   u8 lsr; /* WR LSR - Line Status Reg */
+   u8 msr; /* WR MSR - Modem Status Reg */
+   u8 spr; /* WR SPR - Scratch Pad Reg */
 };
 
 /* Where to read the interrupt register (8bits) */
@@ -61,8 +61,8 @@ struct cls_uart_struct {
 #define UART_16654_FCR_RXTRIGGER_560x80
 #define UART_16654_FCR_RXTRIGGER_60 0xC0
 
-#define UART_IIR_CTSRTS0x20/* Received CTS/RTS 
change of state */
-#define UART_IIR_RDI_TIMEOUT   0x0C/* Receiver data TIMEOUT */
+#define UART_IIR_CTSRTS0x20/* Received CTS/RTS change of 
state */
+#define UART_IIR_RDI_TIMEOUT   0x0C/* Receiver data TIMEOUT */
 
 /*
  * These are the EXTENDED definitions for the Exar 654's Interrupt
@@ -74,8 +74,8 @@ struct cls_uart_struct {
 #define UART_EXAR654_EFR_RTSDTR   0x40/* Auto RTS/DTR Flow Control Enable 
*/
 #define UART_EXAR654_EFR_CTSDSR   0x80/* Auto CTS/DSR Flow COntrol Enable 
*/
 
-#define UART_EXAR654_XOFF_DETECT  0x1 /* Indicates whether chip saw an 
incoming XOFF char  */
-#define UART_EXAR654_XON_DETECT   0x2 /* Indicates whether chip saw an 
incoming XON char */
+#define UART_EXAR654_XOFF_DETECT  0x1 /* Chip saw an incoming XOFF char  */
+#define UART_EXAR654_XON_DETECT   0x2 /* Chip saw an incoming XON char */
 
 #define UART_EXAR654_IER_XOFF 0x20/* Xoff Interrupt Enable */
 #define UART_EXAR654_IER_RTSDTR   0x40/* Output Interrupt Enable */
diff --git a/drivers/staging/dgnc/dgnc_driver.c 
b/drivers/staging/dgnc/dgnc_driver.c
index ba98ff3..a2120cf 100644
--- a/drivers/staging/dgnc/dgnc_driver.c
+++ b/drivers/staging/dgnc/dgnc_driver.c
@@ -54,14 +54,14 @@ MODULE_SUPPORTED_DEVICE("dgnc");
  * protos for this file
  *
  */
-static int dgnc_start(void);
-static int dgnc_finalize_board_init(struct dgnc_board *brd);
-static voiddgnc_init_globals(void);
-static int dgnc_found_board(struct pci_dev *pdev, int id);
-static voiddgnc_cleanup_board(struct dgnc_board *brd);
-static voiddgnc_poll_handler(ulong dummy);
-static int dgnc_init_one(struct pci_dev *pdev, const struct 
pci_device_id *ent);
-static voiddgnc_do_remap(struct dgnc_board *brd);
+static int dgnc_start(void);
+static int dgnc_finalize_board_init(struct dgnc_board *brd);
+static void dgnc_init_globals(void);
+static int dgnc_found_board(struct pci_dev *pdev, int id);
+static void dgnc_cleanup_board(struct dgnc_board *brd);
+static void dgnc_poll_handler(ulong dummy);
+static int dgnc_init_one(struct pci_dev *pdev, const struct pci_device_id 
*ent);
+static void dgnc_do_remap(struct dgnc_board *brd);
 
 /*
  * File operations permitted on Control/Management major.
@@ -92,17 +92,17 @@ static struct class *dgnc_class;
  * Poller stuff
  */
 static DEFINE_SPINLOCK(dgnc_poll_lock); /* Poll scheduling lock */
-static ulong   dgnc_poll_time; /* Time of next 
poll */
-static uintdgnc_poll_stop; /* Used to tell 
poller to stop */
+static ulong   dgnc_poll_time; /* Time of next poll */
+static uintdgnc_poll_stop; /* Used to tell poller to stop */
 static s