Re: [PATCH 06/13] staging: rtl8188eu: Remove unused funtion _rtw_read_mem()

2014-06-10 Thread Dan Carpenter
Thanks.  This is much nicer to review when they are all folded together
like this.

regards,
dan carpenter

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


Re: [PATCH] Staging: rtl8821ae: use kmalloc instead of variable length stack arrays

2014-06-10 Thread Dan Carpenter
On Wed, Jun 04, 2014 at 07:45:45PM +0200, Remi Pommarel wrote:
 This removes stack arrays of variable length and use kmalloc() instead, thus
 removing the sparse warnings Variable length array is used.
 
 Signed-off-by: Remi Pommarel r...@triplefau.lt
 ---
  drivers/staging/rtl8821ae/efuse.c | 38 +++---
  1 file changed, 31 insertions(+), 7 deletions(-)
 
 diff --git a/drivers/staging/rtl8821ae/efuse.c 
 b/drivers/staging/rtl8821ae/efuse.c
 index 206012c..a41aa84 100644
 --- a/drivers/staging/rtl8821ae/efuse.c
 +++ b/drivers/staging/rtl8821ae/efuse.c
 @@ -232,7 +232,7 @@ void read_efuse(struct ieee80211_hw *hw, u16 _offset, u16 
 _size_byte, u8 *pbuf)
  {
   struct rtl_priv *rtlpriv = rtl_priv(hw);
   struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
 - u8 efuse_tbl[rtlpriv-cfg-maps[EFUSE_HWSET_MAX_SIZE]];
 + u8 *efuse_tbl;
   u8 rtemp8[1];
   u16 efuse_addr = 0;
   u8 offset, wren;
 @@ -243,7 +243,7 @@ void read_efuse(struct ieee80211_hw *hw, u16 _offset, u16 
 _size_byte, u8 *pbuf)
   rtlpriv-cfg-maps[EFUSE_MAX_SECTION_MAP];
   const u32 efuse_real_content_len =
   rtlpriv-cfg-maps[EFUSE_REAL_CONTENT_SIZE];
 - u16 efuse_word[efuse_max_section][EFUSE_MAX_WORD_UNIT];
 + u16 **efuse_word;
   u16 efuse_utilized = 0;
   u8 efuse_usage;
  
 @@ -254,9 +254,26 @@ void read_efuse(struct ieee80211_hw *hw, u16 _offset, 
 u16 _size_byte, u8 *pbuf)
   return;
   }
  
 + efuse_tbl = kmalloc(rtlpriv-cfg-maps[EFUSE_HWSET_MAX_SIZE] *
 + sizeof(*efuse_tbl), GFP_ATOMIC);

sizeof(*efuse_tbl) is a complicated way to say 1.  Just say:

efuse_tbl = kmalloc(rtlpriv-cfg-maps[EFUSE_HWSET_MAX_SIZE], 
GFP_ATOMIC);

Why is it GFP_ATOMIC btw?  That wasn't immediately clear to me and I
didn't spend a lot of time looking.

 + if (efuse_tbl == NULL)
 + return;
 +
 + efuse_word = kcalloc(EFUSE_MAX_WORD_UNIT, sizeof(*efuse_word),
 + GFP_ATOMIC);
 + if (efuse_word == NULL)
 + goto out;
 +
 + for (i = 0; i  EFUSE_MAX_WORD_UNIT; i++) {
 + efuse_word[i] = kmalloc(efuse_max_section *
 + sizeof(**efuse_word), GFP_ATOMIC);
 + if (efuse_word[i] == NULL)
 + goto done;
 + }


Why is this so complicated?  Why not just:

efuse_word = kmalloc(sizeof(*efuse_word) * efuse_max_section *
 EFUSE_MAX_WORD_UNIT, GFP_ATOMIC);


 +
   for (i = 0; i  efuse_max_section; i++)
   for (j = 0; j  EFUSE_MAX_WORD_UNIT; j++)
 - efuse_word[i][j] = 0x;
 + efuse_word[j][i] = 0x;

Why are you re-ordering things here?

regards,
dan carpenter

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


[PATCH v13 03/10] imx-drm: Correct BGR666 and the board's dts that use them.

2014-06-10 Thread Denis Carikli
The current BGR666 is not consistent with the other color mapings like BGR24.
BGR666 should be in the same byte order than BGR24.

Signed-off-by: Denis Carikli de...@eukrea.com
Acked-by: Philipp Zabel p.za...@pengutronix.de
---
ChangeLog v10-v13:
- Rebased
ChangeLog v9-v10:
- Rebased.
- Added Philipp Zabel's Ack.
- Included Lothar Waßmann's suggestion about imx-ldb.c.
- Shortened the patch title

ChangeLog v8-v9:
- Removed the Cc. They are now set in git-send-email directly.

ChangeLog v7-v8:
- Shrinked even more the Cc list.

ChangeLog v6-v7:
- Shrinked even more the Cc list.

ChangeLog v5-v6:
- Remove people not concerned by this patch from the Cc list.
- Added a better explanation of the change.

ChangeLog v5:
- New patch.
---
 arch/arm/boot/dts/imx51-apf51dev.dts|2 +-
 arch/arm/boot/dts/imx53-m53evk.dts  |2 +-
 drivers/staging/imx-drm/imx-ldb.c   |4 ++--
 drivers/staging/imx-drm/ipu-v3/ipu-dc.c |4 ++--
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/arm/boot/dts/imx51-apf51dev.dts 
b/arch/arm/boot/dts/imx51-apf51dev.dts
index c5a9a24..7b3851d 100644
--- a/arch/arm/boot/dts/imx51-apf51dev.dts
+++ b/arch/arm/boot/dts/imx51-apf51dev.dts
@@ -18,7 +18,7 @@
 
display@di1 {
compatible = fsl,imx-parallel-display;
-   interface-pix-fmt = bgr666;
+   interface-pix-fmt = rgb666;
pinctrl-names = default;
pinctrl-0 = pinctrl_ipu_disp1;
 
diff --git a/arch/arm/boot/dts/imx53-m53evk.dts 
b/arch/arm/boot/dts/imx53-m53evk.dts
index d5d146a..4b036b4 100644
--- a/arch/arm/boot/dts/imx53-m53evk.dts
+++ b/arch/arm/boot/dts/imx53-m53evk.dts
@@ -24,7 +24,7 @@
soc {
display1: display@di1 {
compatible = fsl,imx-parallel-display;
-   interface-pix-fmt = bgr666;
+   interface-pix-fmt = rgb666;
pinctrl-names = default;
pinctrl-0 = pinctrl_ipu_disp1;
 
diff --git a/drivers/staging/imx-drm/imx-ldb.c 
b/drivers/staging/imx-drm/imx-ldb.c
index 7e3f019..5d22e40 100644
--- a/drivers/staging/imx-drm/imx-ldb.c
+++ b/drivers/staging/imx-drm/imx-ldb.c
@@ -188,11 +188,11 @@ static void imx_ldb_encoder_prepare(struct drm_encoder 
*encoder)
switch (imx_ldb_ch-chno) {
case 0:
pixel_fmt = (ldb-ldb_ctrl  LDB_DATA_WIDTH_CH0_24) ?
-   V4L2_PIX_FMT_RGB24 : V4L2_PIX_FMT_BGR666;
+   V4L2_PIX_FMT_RGB24 : V4L2_PIX_FMT_RGB666;
break;
case 1:
pixel_fmt = (ldb-ldb_ctrl  LDB_DATA_WIDTH_CH1_24) ?
-   V4L2_PIX_FMT_RGB24 : V4L2_PIX_FMT_BGR666;
+   V4L2_PIX_FMT_RGB24 : V4L2_PIX_FMT_RGB666;
break;
default:
dev_err(ldb-dev, unable to config di%d panel format\n,
diff --git a/drivers/staging/imx-drm/ipu-v3/ipu-dc.c 
b/drivers/staging/imx-drm/ipu-v3/ipu-dc.c
index 9d0324d..cd250d5 100644
--- a/drivers/staging/imx-drm/ipu-v3/ipu-dc.c
+++ b/drivers/staging/imx-drm/ipu-v3/ipu-dc.c
@@ -440,9 +440,9 @@ int ipu_dc_init(struct ipu_soc *ipu, struct device *dev,
 
/* bgr666 */
ipu_dc_map_clear(priv, IPU_DC_MAP_BGR666);
-   ipu_dc_map_config(priv, IPU_DC_MAP_BGR666, 0, 5, 0xfc); /* blue */
+   ipu_dc_map_config(priv, IPU_DC_MAP_BGR666, 0, 17, 0xfc); /* blue */
ipu_dc_map_config(priv, IPU_DC_MAP_BGR666, 1, 11, 0xfc); /* green */
-   ipu_dc_map_config(priv, IPU_DC_MAP_BGR666, 2, 17, 0xfc); /* red */
+   ipu_dc_map_config(priv, IPU_DC_MAP_BGR666, 2, 5, 0xfc); /* red */
 
/* lvds666 */
ipu_dc_map_clear(priv, IPU_DC_MAP_LVDS666);
-- 
1.7.9.5

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


[PATCH v13 04/10] imx-drm: use defines for clock polarity settings

2014-06-10 Thread Denis Carikli
Signed-off-by: Denis Carikli de...@eukrea.com
---
ChangeLog 12-v13:
- No changes
ChangeLog 11-v12:
- Improved the define names to match the hardware:
  ENABLE_POL is not a clock signal but instead an enable signal.

ChangeLog v9-v10:
- New patch which was splitted out from:
  staging: imx-drm: Use de-active and pixelclk-active display-timings..
- Fixes many issues in staging: imx-drm: Use de-active and pixelclk-active
  display-timings.:
  - More clear meaning of the polarity settings.
  - The SET_CLK_POL and SET_DE_POL masks are not
needed anymore.
---
 drivers/staging/imx-drm/ipu-v3/imx-ipu-v3.h |8 +++-
 drivers/staging/imx-drm/ipu-v3/ipu-di.c |4 ++--
 drivers/staging/imx-drm/ipuv3-crtc.c|4 ++--
 3 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/imx-drm/ipu-v3/imx-ipu-v3.h 
b/drivers/staging/imx-drm/ipu-v3/imx-ipu-v3.h
index c2c6fab..015e3bf 100644
--- a/drivers/staging/imx-drm/ipu-v3/imx-ipu-v3.h
+++ b/drivers/staging/imx-drm/ipu-v3/imx-ipu-v3.h
@@ -27,6 +27,12 @@ enum ipuv3_type {
 
 #define IPU_PIX_FMT_GBR24  v4l2_fourcc('G', 'B', 'R', '3')
 
+#define CLK_POL_NEGEDGE0
+#define CLK_POL_POSEDGE1
+
+#define ENABLE_POL_LOW 0
+#define ENABLE_POL_HIGH1
+
 /*
  * Bitfield of Display Interface signal polarities.
  */
@@ -37,7 +43,7 @@ struct ipu_di_signal_cfg {
unsigned clksel_en:1;
unsigned clkidle_en:1;
unsigned data_pol:1;/* true = inverted */
-   unsigned clk_pol:1; /* true = rising edge */
+   unsigned clk_pol:1;
unsigned enable_pol:1;
unsigned Hsync_pol:1;   /* true = active high */
unsigned Vsync_pol:1;
diff --git a/drivers/staging/imx-drm/ipu-v3/ipu-di.c 
b/drivers/staging/imx-drm/ipu-v3/ipu-di.c
index 849b3e1..0ce3f52 100644
--- a/drivers/staging/imx-drm/ipu-v3/ipu-di.c
+++ b/drivers/staging/imx-drm/ipu-v3/ipu-di.c
@@ -595,7 +595,7 @@ int ipu_di_init_sync_panel(struct ipu_di *di, struct 
ipu_di_signal_cfg *sig)
}
}
 
-   if (sig-clk_pol)
+   if (sig-clk_pol == CLK_POL_POSEDGE)
di_gen |= DI_GEN_POLARITY_DISP_CLK;
 
ipu_di_write(di, di_gen, DI_GENERAL);
@@ -606,7 +606,7 @@ int ipu_di_init_sync_panel(struct ipu_di *di, struct 
ipu_di_signal_cfg *sig)
reg = ipu_di_read(di, DI_POL);
reg = ~(DI_POL_DRDY_DATA_POLARITY | DI_POL_DRDY_POLARITY_15);
 
-   if (sig-enable_pol)
+   if (sig-enable_pol == ENABLE_POL_HIGH)
reg |= DI_POL_DRDY_POLARITY_15;
if (sig-data_pol)
reg |= DI_POL_DRDY_DATA_POLARITY;
diff --git a/drivers/staging/imx-drm/ipuv3-crtc.c 
b/drivers/staging/imx-drm/ipuv3-crtc.c
index 47bec5e..ba9eea3 100644
--- a/drivers/staging/imx-drm/ipuv3-crtc.c
+++ b/drivers/staging/imx-drm/ipuv3-crtc.c
@@ -165,8 +165,8 @@ static int ipu_crtc_mode_set(struct drm_crtc *crtc,
if (mode-flags  DRM_MODE_FLAG_PVSYNC)
sig_cfg.Vsync_pol = 1;
 
-   sig_cfg.enable_pol = 1;
-   sig_cfg.clk_pol = 0;
+   sig_cfg.enable_pol = ENABLE_POL_HIGH;
+   sig_cfg.clk_pol = CLK_POL_NEGEDGE;
sig_cfg.width = mode-hdisplay;
sig_cfg.height = mode-vdisplay;
sig_cfg.pixel_fmt = out_pixel_fmt;
-- 
1.7.9.5

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


[PATCH v13 01/10] [media] v4l2: add new V4L2_PIX_FMT_RGB666 pixel format.

2014-06-10 Thread Denis Carikli
That new macro is needed by the imx_drm staging driver
  for supporting the QVGA display of the eukrea-cpuimx51 board.

Signed-off-by: Denis Carikli de...@eukrea.com
Acked-by: Mauro Carvalho Chehab m.che...@samsung.com
Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
Acked-by: Philipp Zabel p.za...@pengutronix.de
---
ChangeLog v10-v13:
- No changes
ChangeLog v9-v10:
- Rebased on top of:
  211e7f2 [media] DocBook media: drop the old incorrect packed RGB table
- Added Philipp Zabel's Ack.

ChangeLog v8-v9:
- Removed the Cc. They are now set in git-send-email directly.

ChangeLog v7-v8:
- Added Mauro Carvalho Chehab back to the list of Cc

ChangeLog v6-v7:
- Shrinked even more the Cc list.
ChangeLog v5-v6:
- Remove people not concerned by this patch from the Cc list.

ChangeLog v3-v4:
- Added Laurent Pinchart's Ack.

ChangeLog v2-v3:
- Added some interested people in the Cc list.
- Added Mauro Carvalho Chehab's Ack.
- Added documentation.
---
 .../DocBook/media/v4l/pixfmt-packed-rgb.xml|   39 
 include/uapi/linux/videodev2.h |1 +
 2 files changed, 40 insertions(+)

diff --git a/Documentation/DocBook/media/v4l/pixfmt-packed-rgb.xml 
b/Documentation/DocBook/media/v4l/pixfmt-packed-rgb.xml
index e1c4f8b..88a7fe1 100644
--- a/Documentation/DocBook/media/v4l/pixfmt-packed-rgb.xml
+++ b/Documentation/DocBook/media/v4l/pixfmt-packed-rgb.xml
@@ -279,6 +279,45 @@ colorspace 
constantV4L2_COLORSPACE_SRGB/constant./para
entry/entry
entry/entry
  /row
+ row id=V4L2-PIX-FMT-RGB666
+   entryconstantV4L2_PIX_FMT_RGB666/constant/entry
+   entry'RGBH'/entry
+   entry/entry
+   entryrsubscript5/subscript/entry
+   entryrsubscript4/subscript/entry
+   entryrsubscript3/subscript/entry
+   entryrsubscript2/subscript/entry
+   entryrsubscript1/subscript/entry
+   entryrsubscript0/subscript/entry
+   entrygsubscript5/subscript/entry
+   entrygsubscript4/subscript/entry
+   entry/entry
+   entrygsubscript3/subscript/entry
+   entrygsubscript2/subscript/entry
+   entrygsubscript1/subscript/entry
+   entrygsubscript0/subscript/entry
+   entrybsubscript5/subscript/entry
+   entrybsubscript4/subscript/entry
+   entrybsubscript3/subscript/entry
+   entrybsubscript2/subscript/entry
+   entry/entry
+   entrybsubscript1/subscript/entry
+   entrybsubscript0/subscript/entry
+   entry/entry
+   entry/entry
+   entry/entry
+   entry/entry
+   entry/entry
+   entry/entry
+   entry/entry
+   entry/entry
+   entry/entry
+   entry/entry
+   entry/entry
+   entry/entry
+   entry/entry
+   entry/entry
+ /row
  row id=V4L2-PIX-FMT-BGR24
entryconstantV4L2_PIX_FMT_BGR24/constant/entry
entry'BGR3'/entry
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index 168ff50..08cac01 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -299,6 +299,7 @@ struct v4l2_pix_format {
 #define V4L2_PIX_FMT_RGB555X v4l2_fourcc('R', 'G', 'B', 'Q') /* 16  RGB-5-5-5 
BE  */
 #define V4L2_PIX_FMT_RGB565X v4l2_fourcc('R', 'G', 'B', 'R') /* 16  RGB-5-6-5 
BE  */
 #define V4L2_PIX_FMT_BGR666  v4l2_fourcc('B', 'G', 'R', 'H') /* 18  BGR-6-6-6  
  */
+#define V4L2_PIX_FMT_RGB666  v4l2_fourcc('R', 'G', 'B', 'H') /* 18  RGB-6-6-6  
  */
 #define V4L2_PIX_FMT_BGR24   v4l2_fourcc('B', 'G', 'R', '3') /* 24  BGR-8-8-8  
   */
 #define V4L2_PIX_FMT_RGB24   v4l2_fourcc('R', 'G', 'B', '3') /* 24  RGB-8-8-8  
   */
 #define V4L2_PIX_FMT_BGR32   v4l2_fourcc('B', 'G', 'R', '4') /* 32  
BGR-8-8-8-8   */
-- 
1.7.9.5

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


[PATCH v13 02/10] imx-drm: Add RGB666 support for parallel display.

2014-06-10 Thread Denis Carikli
Signed-off-by: Denis Carikli de...@eukrea.com
Acked-by: Philipp Zabel p.za...@pengutronix.de
---
ChangeLog v9-v13:
- Rebased
ChangeLog v8-v9:
- Rebased.
- Added Philipp Zabel's ack.
- Shortened the patch title.

ChangeLog v8-v9:
- Removed the Cc. They are now set in git-send-email directly.
- Rebased.

ChangeLog v7-v8:
- Shrinked even more the Cc list.

ChangeLog v6-v7:
- Shrinked even more the Cc list.

ChangeLog v5-v6:
- Remove people not concerned by this patch from the Cc list.

ChangeLog v3-v5:
- Use the correct RGB order.

ChangeLog v2-v3:
- Added some interested people in the Cc list.
- Removed the commit message long desciption that was just a copy of the short
  description.
- Rebased the patch.
- Fixed a copy-paste error in the ipu_dc_map_clear parameter.
---
 .../bindings/staging/imx-drm/fsl-imx-drm.txt   |4 ++--
 drivers/staging/imx-drm/ipu-v3/ipu-dc.c|9 +
 drivers/staging/imx-drm/parallel-display.c |2 ++
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/staging/imx-drm/fsl-imx-drm.txt 
b/Documentation/devicetree/bindings/staging/imx-drm/fsl-imx-drm.txt
index e75f0e5..c0eb95a 100644
--- a/Documentation/devicetree/bindings/staging/imx-drm/fsl-imx-drm.txt
+++ b/Documentation/devicetree/bindings/staging/imx-drm/fsl-imx-drm.txt
@@ -60,8 +60,8 @@ Required properties:
 - compatible: Should be fsl,imx-parallel-display
 Optional properties:
 - interface_pix_fmt: How this display is connected to the
-  display interface. Currently supported types: rgb24, rgb565, bgr666
-  and lvds666.
+  display interface. Currently supported types: rgb24, rgb565, bgr666,
+  rgb666 and lvds666.
 - edid: verbatim EDID data block describing attached display.
 - ddc: phandle describing the i2c bus handling the display data
   channel
diff --git a/drivers/staging/imx-drm/ipu-v3/ipu-dc.c 
b/drivers/staging/imx-drm/ipu-v3/ipu-dc.c
index 784a4a1..9d0324d 100644
--- a/drivers/staging/imx-drm/ipu-v3/ipu-dc.c
+++ b/drivers/staging/imx-drm/ipu-v3/ipu-dc.c
@@ -94,6 +94,7 @@ enum ipu_dc_map {
IPU_DC_MAP_BGR666,
IPU_DC_MAP_LVDS666,
IPU_DC_MAP_BGR24,
+   IPU_DC_MAP_RGB666,
 };
 
 struct ipu_dc {
@@ -162,6 +163,8 @@ static int ipu_pixfmt_to_map(u32 fmt)
return IPU_DC_MAP_LVDS666;
case V4L2_PIX_FMT_BGR24:
return IPU_DC_MAP_BGR24;
+   case V4L2_PIX_FMT_RGB666:
+   return IPU_DC_MAP_RGB666;
default:
return -EINVAL;
}
@@ -453,6 +456,12 @@ int ipu_dc_init(struct ipu_soc *ipu, struct device *dev,
ipu_dc_map_config(priv, IPU_DC_MAP_BGR24, 1, 15, 0xff); /* green */
ipu_dc_map_config(priv, IPU_DC_MAP_BGR24, 0, 23, 0xff); /* blue */
 
+   /* rgb666 */
+   ipu_dc_map_clear(priv, IPU_DC_MAP_RGB666);
+   ipu_dc_map_config(priv, IPU_DC_MAP_RGB666, 0, 5, 0xfc); /* blue */
+   ipu_dc_map_config(priv, IPU_DC_MAP_RGB666, 1, 11, 0xfc); /* green */
+   ipu_dc_map_config(priv, IPU_DC_MAP_RGB666, 2, 17, 0xfc); /* red */
+
return 0;
 }
 
diff --git a/drivers/staging/imx-drm/parallel-display.c 
b/drivers/staging/imx-drm/parallel-display.c
index b567832..64b34336 100644
--- a/drivers/staging/imx-drm/parallel-display.c
+++ b/drivers/staging/imx-drm/parallel-display.c
@@ -218,6 +218,8 @@ static int imx_pd_bind(struct device *dev, struct device 
*master, void *data)
imxpd-interface_pix_fmt = V4L2_PIX_FMT_RGB565;
else if (!strcmp(fmt, bgr666))
imxpd-interface_pix_fmt = V4L2_PIX_FMT_BGR666;
+   else if (!strcmp(fmt, rgb666))
+   imxpd-interface_pix_fmt = V4L2_PIX_FMT_RGB666;
else if (!strcmp(fmt, lvds666))
imxpd-interface_pix_fmt = v4l2_fourcc('L', 'V', 'D', 
'6');
}
-- 
1.7.9.5

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


[PATCH v13 05/10] ARM: dts: imx5*, imx6*: correct display-timings nodes.

2014-06-10 Thread Denis Carikli
The imx-drm driver can't use the de-active and
pixelclk-active display-timings properties yet.

Instead the data-enable and the pixel data clock
polarity are hardcoded in the imx-drm driver.

So theses properties are now set to keep
the same behaviour when imx-drm will start
using them.

Signed-off-by: Denis Carikli de...@eukrea.com
---
ChangeLog v10-v11:
- imx53-tx53-x03x.dts change was removed because it 
  already had the correct setting.
ChangeLog v9-v10:
- New patch that was splitted out of:
  staging imx-drm: Use de-active and pixelclk-active
  display-timings.
---
 arch/arm/boot/dts/imx51-babbage.dts   |2 ++
 arch/arm/boot/dts/imx53-m53evk.dts|2 ++
 arch/arm/boot/dts/imx6qdl-gw53xx.dtsi |2 ++
 arch/arm/boot/dts/imx6qdl-gw54xx.dtsi |2 ++
 arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi |2 ++
 arch/arm/boot/dts/imx6qdl-sabreauto.dtsi  |2 ++
 arch/arm/boot/dts/imx6qdl-sabrelite.dtsi  |2 ++
 arch/arm/boot/dts/imx6qdl-sabresd.dtsi|2 ++
 8 files changed, 16 insertions(+)

diff --git a/arch/arm/boot/dts/imx51-babbage.dts 
b/arch/arm/boot/dts/imx51-babbage.dts
index ee51a10..b64a9e3 100644
--- a/arch/arm/boot/dts/imx51-babbage.dts
+++ b/arch/arm/boot/dts/imx51-babbage.dts
@@ -56,6 +56,8 @@
vfront-porch = 7;
hsync-len = 60;
vsync-len = 10;
+   de-active = 1;
+   pixelclk-active = 0;
};
};
 
diff --git a/arch/arm/boot/dts/imx53-m53evk.dts 
b/arch/arm/boot/dts/imx53-m53evk.dts
index 4b036b4..d03ced7 100644
--- a/arch/arm/boot/dts/imx53-m53evk.dts
+++ b/arch/arm/boot/dts/imx53-m53evk.dts
@@ -41,6 +41,8 @@
vfront-porch = 9;
vsync-len = 3;
vsync-active = 1;
+   de-active = 1;
+   pixelclk-active = 0;
};
};
};
diff --git a/arch/arm/boot/dts/imx6qdl-gw53xx.dtsi 
b/arch/arm/boot/dts/imx6qdl-gw53xx.dtsi
index d3125f0..7f993d6 100644
--- a/arch/arm/boot/dts/imx6qdl-gw53xx.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-gw53xx.dtsi
@@ -512,6 +512,8 @@
vfront-porch = 7;
hsync-len = 60;
vsync-len = 10;
+   de-active = 1;
+   pixelclk-active = 0;
};
};
};
diff --git a/arch/arm/boot/dts/imx6qdl-gw54xx.dtsi 
b/arch/arm/boot/dts/imx6qdl-gw54xx.dtsi
index 532347f..e06cf9e 100644
--- a/arch/arm/boot/dts/imx6qdl-gw54xx.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-gw54xx.dtsi
@@ -534,6 +534,8 @@
vfront-porch = 7;
hsync-len = 60;
vsync-len = 10;
+   de-active = 1;
+   pixelclk-active = 0;
};
};
};
diff --git a/arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi 
b/arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi
index 4c4b175..bcf5178 100644
--- a/arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi
@@ -353,6 +353,8 @@
vfront-porch = 7;
hsync-len = 60;
vsync-len = 10;
+   de-active = 1;
+   pixelclk-active = 0;
};
};
};
diff --git a/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi 
b/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi
index 009abd6..230bbc6 100644
--- a/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi
@@ -405,6 +405,8 @@
vfront-porch = 7;
hsync-len = 60;
vsync-len = 10;
+   de-active = 1;
+   pixelclk-active = 0;
};
};
};
diff --git a/arch/arm/boot/dts/imx6qdl-sabrelite.dtsi 
b/arch/arm/boot/dts/imx6qdl-sabrelite.dtsi
index 6df6127..9f6b406 100644
--- a/arch/arm/boot/dts/imx6qdl-sabrelite.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-sabrelite.dtsi
@@ -353,6 +353,8 @@
vfront-porch = 7;
hsync-len = 60;
vsync-len = 10;
+   de-active = 1;
+   pixelclk-active = 0;
};
};
};
diff --git a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi 
b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
index e446192..3297779 100644
--- 

[PATCH v13 07/10] imx-drm: Use drm_display_mode timings flags.

2014-06-10 Thread Denis Carikli
The previous hardware behaviour was kept if the
flags are not set.

Signed-off-by: Denis Carikli de...@eukrea.com
---
ChangeLog v12-v13:
- This patch doesn't need the DRM_MODE_FLAG_POL_*_PRESERVE flags anymore.
- code cleanup to improve readability:
  - ENABLE_POL_PRESERVE is now gone
  - Less modifications in ipu_di_init_sync_panel
  - more readable modifications in int ipu_crtc_mode_set
ChangeLog v11-v12:
- Rebased: It now uses the following new flags defines names:
  CLK_POL, ENABLE_POL
- The inversions in ipuv3-crtc.c are now fixed.
- ipuv3-crtc.c was still using mode-private_flags
  from the previous versions of this patchset, that's now fixed.

ChangeLog v10-v11:
- This patch was splitted-out and adapted from:
  Prepare imx-drm for extra display-timings retrival.
- The display-timings dt specific part was removed.
- The flags names were changed to use the DRM ones from:
  drm: drm_display_mode: add signal polarity flags
---
 drivers/staging/imx-drm/ipu-v3/imx-ipu-v3.h |4 ++--
 drivers/staging/imx-drm/ipu-v3/ipu-di.c |2 ++
 drivers/staging/imx-drm/ipuv3-crtc.c|   18 --
 3 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/imx-drm/ipu-v3/imx-ipu-v3.h 
b/drivers/staging/imx-drm/ipu-v3/imx-ipu-v3.h
index 015e3bf..94b0d8e 100644
--- a/drivers/staging/imx-drm/ipu-v3/imx-ipu-v3.h
+++ b/drivers/staging/imx-drm/ipu-v3/imx-ipu-v3.h
@@ -43,10 +43,10 @@ struct ipu_di_signal_cfg {
unsigned clksel_en:1;
unsigned clkidle_en:1;
unsigned data_pol:1;/* true = inverted */
-   unsigned clk_pol:1;
-   unsigned enable_pol:1;
unsigned Hsync_pol:1;   /* true = active high */
unsigned Vsync_pol:1;
+   u8 clk_pol;
+   u8 enable_pol;
 
u16 width;
u16 height;
diff --git a/drivers/staging/imx-drm/ipu-v3/ipu-di.c 
b/drivers/staging/imx-drm/ipu-v3/ipu-di.c
index 0ce3f52..faf08e2 100644
--- a/drivers/staging/imx-drm/ipu-v3/ipu-di.c
+++ b/drivers/staging/imx-drm/ipu-v3/ipu-di.c
@@ -597,6 +597,8 @@ int ipu_di_init_sync_panel(struct ipu_di *di, struct 
ipu_di_signal_cfg *sig)
 
if (sig-clk_pol == CLK_POL_POSEDGE)
di_gen |= DI_GEN_POLARITY_DISP_CLK;
+   else if (sig-clk_pol == CLK_POL_NEGEDGE)
+   di_gen = ~DI_GEN_POLARITY_DISP_CLK;
 
ipu_di_write(di, di_gen, DI_GENERAL);
 
diff --git a/drivers/staging/imx-drm/ipuv3-crtc.c 
b/drivers/staging/imx-drm/ipuv3-crtc.c
index ba9eea3..10b46b5 100644
--- a/drivers/staging/imx-drm/ipuv3-crtc.c
+++ b/drivers/staging/imx-drm/ipuv3-crtc.c
@@ -165,8 +165,22 @@ static int ipu_crtc_mode_set(struct drm_crtc *crtc,
if (mode-flags  DRM_MODE_FLAG_PVSYNC)
sig_cfg.Vsync_pol = 1;
 
-   sig_cfg.enable_pol = ENABLE_POL_HIGH;
-   sig_cfg.clk_pol = CLK_POL_NEGEDGE;
+   if (mode-pol_flags  DRM_MODE_FLAG_POL_PIXDATA_POSEDGE)
+   sig_cfg.clk_pol = CLK_POL_POSEDGE;
+   else if (mode-pol_flags  DRM_MODE_FLAG_POL_PIXDATA_NEGEDGE)
+   sig_cfg.clk_pol = CLK_POL_NEGEDGE;
+   else
+   /* If no PIXDATA flags were set, keep the old behaviour */
+   sig_cfg.clk_pol = CLK_POL_NEGEDGE;
+
+   if (mode-pol_flags  DRM_MODE_FLAG_POL_DE_HIGH)
+   sig_cfg.enable_pol = ENABLE_POL_HIGH;
+   else if (mode-pol_flags  DRM_MODE_FLAG_POL_DE_LOW)
+   sig_cfg.enable_pol = ENABLE_POL_LOW;
+   else
+   /* If no DE flags were set, keep the old behaviour */
+   sig_cfg.enable_pol = ENABLE_POL_HIGH;
+
sig_cfg.width = mode-hdisplay;
sig_cfg.height = mode-vdisplay;
sig_cfg.pixel_fmt = out_pixel_fmt;
-- 
1.7.9.5

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


[PATCH v13 08/10] drm/panel: Add Eukrea mbimxsd51 displays.

2014-06-10 Thread Denis Carikli
Signed-off-by: Denis Carikli de...@eukrea.com
---
ChangeLog v12-v13:
- Added a note explaining why the size is zero in
  the eukrea_mbimxsd51_dvi(s)vga structs.
ChangeLog v11-v12:
- Rebased: It now uses the new DRM_MODE_FLAG_POL_DE flags defines names

ChangeLog v10-v11:
- New patch.
---
 .../bindings/panel/eukrea,mbimxsd51-cmo-qvga.txt   |7 ++
 .../bindings/panel/eukrea,mbimxsd51-dvi-svga.txt   |7 ++
 .../bindings/panel/eukrea,mbimxsd51-dvi-vga.txt|7 ++
 drivers/gpu/drm/panel/panel-simple.c   |   83 
 4 files changed, 104 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/panel/eukrea,mbimxsd51-cmo-qvga.txt
 create mode 100644 
Documentation/devicetree/bindings/panel/eukrea,mbimxsd51-dvi-svga.txt
 create mode 100644 
Documentation/devicetree/bindings/panel/eukrea,mbimxsd51-dvi-vga.txt

diff --git 
a/Documentation/devicetree/bindings/panel/eukrea,mbimxsd51-cmo-qvga.txt 
b/Documentation/devicetree/bindings/panel/eukrea,mbimxsd51-cmo-qvga.txt
new file mode 100644
index 000..03679d0
--- /dev/null
+++ b/Documentation/devicetree/bindings/panel/eukrea,mbimxsd51-cmo-qvga.txt
@@ -0,0 +1,7 @@
+Eukrea CMO-QVGA (320x240 pixels) TFT LCD panel
+
+Required properties:
+- compatible: should be eukrea,mbimxsd51-cmo-qvga
+
+This binding is compatible with the simple-panel binding, which is specified
+in simple-panel.txt in this directory.
diff --git 
a/Documentation/devicetree/bindings/panel/eukrea,mbimxsd51-dvi-svga.txt 
b/Documentation/devicetree/bindings/panel/eukrea,mbimxsd51-dvi-svga.txt
new file mode 100644
index 000..f408c9a
--- /dev/null
+++ b/Documentation/devicetree/bindings/panel/eukrea,mbimxsd51-dvi-svga.txt
@@ -0,0 +1,7 @@
+Eukrea DVI-SVGA (800x600 pixels) DVI output.
+
+Required properties:
+- compatible: should be eukrea,mbimxsd51-dvi-svga
+
+This binding is compatible with the simple-panel binding, which is specified
+in simple-panel.txt in this directory.
diff --git 
a/Documentation/devicetree/bindings/panel/eukrea,mbimxsd51-dvi-vga.txt 
b/Documentation/devicetree/bindings/panel/eukrea,mbimxsd51-dvi-vga.txt
new file mode 100644
index 000..8ea90da
--- /dev/null
+++ b/Documentation/devicetree/bindings/panel/eukrea,mbimxsd51-dvi-vga.txt
@@ -0,0 +1,7 @@
+Eukrea DVI-VGA (640x480 pixels) DVI output.
+
+Required properties:
+- compatible: should be eukrea,mbimxsd51-dvi-vga
+
+This binding is compatible with the simple-panel binding, which is specified
+in simple-panel.txt in this directory.
diff --git a/drivers/gpu/drm/panel/panel-simple.c 
b/drivers/gpu/drm/panel/panel-simple.c
index a251361..adc40a7 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -403,6 +403,80 @@ static const struct panel_desc edt_etm0700g0dh6 = {
},
 };
 
+static const struct drm_display_mode eukrea_mbimxsd51_cmoqvga_mode = {
+   .clock = 6500,
+   .hdisplay = 320,
+   .hsync_start = 320 + 38,
+   .hsync_end = 320 + 38 + 20,
+   .htotal = 320 + 38 + 20 + 30,
+   .vdisplay = 240,
+   .vsync_start = 240 + 15,
+   .vsync_end = 240 + 15 + 4,
+   .vtotal = 240 + 15 + 4 + 3,
+   .vrefresh = 60,
+   .pol_flags = DRM_MODE_FLAG_POL_PIXDATA_NEGEDGE |
+DRM_MODE_FLAG_POL_DE_LOW,
+};
+
+static const struct panel_desc eukrea_mbimxsd51_cmoqvga = {
+   .modes = eukrea_mbimxsd51_cmoqvga_mode,
+   .num_modes = 1,
+   .size = {
+   .width = 73,
+   .height = 56,
+   },
+};
+
+static const struct drm_display_mode eukrea_mbimxsd51_dvisvga_mode = {
+   .clock = 44333,
+   .hdisplay = 800,
+   .hsync_start = 800 + 112,
+   .hsync_end = 800 + 112 + 32,
+   .htotal = 800 + 112 + 32 + 80,
+   .vdisplay = 600,
+   .vsync_start = 600 + 3,
+   .vsync_end = 600 + 3 + 17,
+   .vtotal = 600 + 3 + 17 + 4,
+   .vrefresh = 60,
+   .pol_flags = DRM_MODE_FLAG_POL_PIXDATA_POSEDGE |
+DRM_MODE_FLAG_POL_DE_HIGH,
+};
+
+static const struct panel_desc eukrea_mbimxsd51_dvisvga = {
+   .modes = eukrea_mbimxsd51_dvisvga_mode,
+   .num_modes = 1,
+   /* This is a DVI adapter for external displays */
+   .size = {
+   .width = 0,
+   .height = 0,
+   },
+};
+
+static const struct drm_display_mode eukrea_mbimxsd51_dvivga_mode = {
+   .clock = 23750,
+   .hdisplay = 640,
+   .hsync_start = 640 + 80,
+   .hsync_end = 640 + 80 + 16,
+   .htotal = 640 + 80 + 16 + 64,
+   .vdisplay = 480,
+   .vsync_start = 480 + 3,
+   .vsync_end = 480 + 3 + 13,
+   .vtotal  = 480 + 3 + 13 + 4,
+   .vrefresh = 60,
+   .pol_flags = DRM_MODE_FLAG_POL_PIXDATA_POSEDGE |
+DRM_MODE_FLAG_POL_DE_HIGH,
+};
+
+static const struct panel_desc eukrea_mbimxsd51_dvivga = {
+   .modes = eukrea_mbimxsd51_dvivga_mode,
+   .num_modes = 1,
+   /* This is a DVI adapter for external displays */
+   .size = {
+ 

Re: [PATCH] imx-drm: imx-hdmi: fix hdmi hotplug detection initial state

2014-06-10 Thread Fabio Estevam
On Mon, Jun 9, 2014 at 5:09 PM, Russell King - ARM Linux
li...@arm.linux.org.uk wrote:

 Right, so the problem isn't at the HDMI level, but at the DI level... so
 that's where we need to debug what's being setup.  I left some debugging
 in ipu-di.c - could you try enabling that please?

Booting the kernel with the HDMI cable connected (no image is seen on
HDMI, only on LVDS):

imx-ipuv3 240.ipu: DI0 base: 0x0264 remapped to c08f6000
imx-ipuv3 240.ipu: DI1 base: 0x02648000 remapped to c08fe000
imx-ipuv3 240.ipu: IPUv3H probed
imx-ipuv3 280.ipu: DI0 base: 0x02a4 remapped to c09b6000
imx-ipuv3 280.ipu: DI1 base: 0x02a48000 remapped to c09be000
imx-ipuv3 280.ipu: IPUv3H probed
mmcblk0: mmc1:0007 SD4GB 3.70 GiB
[drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[drm] No driver support for vblank timestamp query.
imx-drm display-subsystem.11: bound imx-ipuv3-crtc.0 (ops ipu_crtc_ops)
imx-drm display-subsystem.11: bound imx-ipuv3-crtc.1 (ops ipu_crtc_ops)
imx-drm display-subsystem.11: bound imx-ipuv3-crtc.2 (ops ipu_crtc_ops)
imx-drm display-subsystem.11: bound imx-ipuv3-crtc.3 (ops ipu_crtc_ops)
imx-hdmi 12.hdmi: Detected HDMI controller 0x13:0xa:0xa0:0xc1
imx-drm display-subsystem.11: bound 12.hdmi (ops hdmi_ops)
imx-drm display-subsystem.11: bound ldb.10 (ops imx_ldb_ops)
 mmcblk0: unknown partition table
imx-ipuv3 240.ipu: disp 0: panel size = 1920 x 1080
imx-ipuv3 240.ipu: Clocks: IPU 26400Hz DI 2400Hz Needed 13850Hz
imx-ipuv3 240.ipu:   IPU clock can give 13200 with divider 2,
error -4.3%
imx-ipuv3 240.ipu: Want 13850Hz IPU 26400Hz DI 13850Hz
using DI, 13850Hz
imx-ipuv3 240.ipu: disp 1: panel size = 1024 x 768
imx-ipuv3 240.ipu: Clocks: IPU 26400Hz DI 6499Hz Needed 6500Hz
imx-ipuv3 240.ipu: Want 6500Hz IPU 26400Hz DI 6499Hz
using DI, 6499Hz

After cable removal:
root@freescale /$ imx-ipuv3 240.ipu: disp 0: panel size = 1024 x 768
imx-ipuv3 240.ipu: Clocks: IPU 26400Hz DI 6499Hz Needed 6500Hz
imx-ipuv3 240.ipu: Want 6500Hz IPU 26400Hz DI 6499Hz
using DI, 6499Hz

After cable re-insertion (image is seen on both HDMI and LVDS):

imx-ipuv3 240.ipu: disp 0: panel size = 1920 x 1080
imx-ipuv3 240.ipu: Clocks: IPU 26400Hz DI 6499Hz Needed 13850Hz
imx-ipuv3 240.ipu:   IPU clock can give 13200 with divider 2,
error -4.3%
imx-ipuv3 240.ipu: Want 13850Hz IPU 26400Hz DI 12997Hz
using DI, 12997Hz
imx-ipuv3 240.ipu: disp 1: panel size = 1024 x 768
imx-ipuv3 240.ipu: Clocks: IPU 26400Hz DI 6499Hz Needed 6500Hz
imx-ipuv3 240.ipu: Want 6500Hz IPU 26400Hz DI 6499Hz
using DI, 6499Hz
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] imx-drm: imx-hdmi: fix hdmi hotplug detection initial state

2014-06-10 Thread Fabio Estevam
On Tue, Jun 10, 2014 at 9:58 AM, Fabio Estevam feste...@gmail.com wrote:
 On Mon, Jun 9, 2014 at 5:09 PM, Russell King - ARM Linux
 li...@arm.linux.org.uk wrote:

 Right, so the problem isn't at the HDMI level, but at the DI level... so
 that's where we need to debug what's being setup.  I left some debugging
 in ipu-di.c - could you try enabling that please?

 Booting the kernel with the HDMI cable connected (no image is seen on
 HDMI, only on LVDS):

In case it helps, I am also able to reproduce the problem on a
imx6dl-hummingboard using the attached debug patch.
From 7084bfd985330890a0a313961682959f7ace3723 Mon Sep 17 00:00:00 2001
From: Fabio Estevam fabio.este...@freescale.com
Date: Tue, 10 Jun 2014 10:28:31 -0300
Subject: [PATCH] imx6dl-hummingboard: Add LVDS support for debugging purposes

Signed-off-by: Fabio Estevam fabio.este...@freescale.com
---
 arch/arm/boot/dts/imx6dl-hummingboard.dts | 25 +
 1 file changed, 25 insertions(+)

diff --git a/arch/arm/boot/dts/imx6dl-hummingboard.dts b/arch/arm/boot/dts/imx6dl-hummingboard.dts
index 5373a5f..e6005ea 100644
--- a/arch/arm/boot/dts/imx6dl-hummingboard.dts
+++ b/arch/arm/boot/dts/imx6dl-hummingboard.dts
@@ -78,6 +78,31 @@
 	status = okay;
 };
 
+ldb {
+	status = okay;
+
+	lvds-channel@1 {
+		fsl,data-mapping = spwg;
+		fsl,data-width = 18;
+		status = okay;
+
+		display-timings {
+			native-mode = timing0;
+			timing0: hsd100pxn1 {
+clock-frequency = 6500;
+hactive = 1024;
+vactive = 768;
+hback-porch = 220;
+hfront-porch = 40;
+vback-porch = 21;
+vfront-porch = 7;
+hsync-len = 60;
+vsync-len = 10;
+			};
+		};
+	};
+};
+
 i2c1 {
 	pinctrl-names = default;
 	pinctrl-0 = pinctrl_hummingboard_i2c1;
-- 
1.8.3.2

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


Re: [PATCH] imx-drm: imx-hdmi: fix hdmi hotplug detection initial state

2014-06-10 Thread Russell King - ARM Linux
On Tue, Jun 10, 2014 at 04:13:06PM +0100, Russell King - ARM Linux wrote:
 where 'M' is the IPU DI clock muxer.  However, we're currently setting
 this up as:
 
 LM --+ LDB serial
   `- /7 -+ LDB DI clock
 IPM --- /N  IM --- IPU DI clock
 
 and hoping that the LDB and IPU DI clocks are appropriately synchronised.

I've just found that we do indeed do this - but there's nothing to
switch the configuration back when the LDB is no longer using a
particular DI.

Also, I'm having a hard time working out why we have the LDB being
given all sorts of clocks...

LM --+- LDB serial  (clks 33, aka di0_pll)
  `- /7 -+- LDB DI clock(clks 135, aka di0)
  `- IM --- IPU DI clock(clks 39, aka di0_sel)

The LDB is given all of these to play with, including reprogramming
the IM, and there's nothing which ever programs IM to anything but
the LDB DI clock once it's set there.

Not only does this feel horribly unclean from the DT perspective, but
it's also a horrid violation of reasonable layering.  What if we wanted
to fix this by adding control of di0_sel to the HDMI interface too?
We then need to list yet again the IPU DI clock and the desired input
clock there, and make the imx-hdmi code aware of that.

Wouldn't it be better to have the ipuv3-crtc, or even the IPU DI code
be in control of its external clock mux, and request the IPU DI code
to select a particular input clock?  In other words, have one central
place where the IPU DI clock is controlled, rather than ending up with
it spread through lots of different sub-drivers?

-- 
FTTC broadband for 0.8mile line: now at 9.7Mbps down 460kbps up... slowly
improving, and getting towards what was expected from it.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Staging: rtl8192e: dot11d: Fixed coding style issues

2014-06-10 Thread Raghavendra
Replaced 'printk' with 'netdev_info' and 'netdev_err' wherever necessary.
Also fixed the coding issue cooresponding to line gap after the declarations.

Signed-off-by: Raghavendra ar...@cdac.in
---
 drivers/staging/rtl8192e/dot11d.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8192e/dot11d.c 
b/drivers/staging/rtl8192e/dot11d.c
index 53da610..ef9da86 100644
--- a/drivers/staging/rtl8192e/dot11d.c
+++ b/drivers/staging/rtl8192e/dot11d.c
@@ -49,6 +49,7 @@ static struct channel_list ChannelPlan[] = {
 void dot11d_init(struct rtllib_device *ieee)
 {
struct rt_dot11d_info *pDot11dInfo = GET_DOT11D_INFO(ieee);
+
pDot11dInfo-bEnabled = false;
 
pDot11dInfo-State = DOT11D_STATE_NONE;
@@ -133,12 +134,12 @@ void Dot11d_UpdateCountryIe(struct rtllib_device *dev, u8 
*pTaddr,
pTriple = (struct chnl_txpow_triple *)(pCoutryIe + 3);
for (i = 0; i  NumTriples; i++) {
if (MaxChnlNum = pTriple-FirstChnl) {
-   printk(KERN_INFO Dot11d_UpdateCountryIe(): Invalid 
country IE, skip it1\n);
+   netdev_info(dev-dev, Dot11d_UpdateCountryIe(): 
Invalid country IE, skip it1\n);
return;
}
if (MAX_CHANNEL_NUMBER  (pTriple-FirstChnl +
pTriple-NumChnls)) {
-   printk(KERN_INFO Dot11d_UpdateCountryIe(): Invalid 
country IE, skip it2\n);
+   netdev_info(dev-dev, Dot11d_UpdateCountryIe(): 
Invalid country IE, skip it2\n);
return;
}
 
@@ -165,7 +166,7 @@ u8 DOT11D_GetMaxTxPwrInDbm(struct rtllib_device *dev, u8 
Channel)
u8 MaxTxPwrInDbm = 255;
 
if (MAX_CHANNEL_NUMBER  Channel) {
-   printk(KERN_INFO DOT11D_GetMaxTxPwrInDbm(): Invalid 
Channel\n);
+   netdev_info(dev-dev, DOT11D_GetMaxTxPwrInDbm(): Invalid 
Channel\n);
return MaxTxPwrInDbm;
}
if (pDot11dInfo-channel_map[Channel])
@@ -204,7 +205,7 @@ int ToLegalChannel(struct rtllib_device *dev, u8 channel)
}
 
if (MAX_CHANNEL_NUMBER  channel) {
-   printk(KERN_ERR %s(): Invalid Channel\n, __func__);
+   netdev_err(dev-dev, %s(): Invalid Channel\n, __func__);
return default_chn;
}
 
-- 
1.8.1.2

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


Re: [PATCH] imx-drm: imx-hdmi: fix hdmi hotplug detection initial state

2014-06-10 Thread Russell King - ARM Linux
On Tue, Jun 10, 2014 at 05:14:21PM +0100, Russell King - ARM Linux wrote:
 On Tue, Jun 10, 2014 at 04:13:06PM +0100, Russell King - ARM Linux wrote:
  where 'M' is the IPU DI clock muxer.  However, we're currently setting
  this up as:
  
  LM --+ LDB serial
`- /7 -+ LDB DI clock
  IPM --- /N  IM --- IPU DI clock
  
  and hoping that the LDB and IPU DI clocks are appropriately synchronised.
 
 I've just found that we do indeed do this - but there's nothing to
 switch the configuration back when the LDB is no longer using a
 particular DI.
 
 Also, I'm having a hard time working out why we have the LDB being
 given all sorts of clocks...
 
 LM --+- LDB serial(clks 33, aka di0_pll)
   `- /7 -+- LDB DI clock  (clks 135, aka di0)
   `- IM --- IPU DI clock  (clks 39, aka di0_sel)
 
 The LDB is given all of these to play with, including reprogramming
 the IM, and there's nothing which ever programs IM to anything but
 the LDB DI clock once it's set there.

*Sigh*... is the clock tree represented in Linux even correct?

--|\
--| |
--| |--+-
--| |  ^ ldb_di0_sel   |
--|/ (clks 33) |
   `-- /3.5  /2 -- G -+--
  ^   ^ ldb_di0_podf  | ^ ldb_di0
  ldb_di0_div_3_5 |
   .--'
   |
   '--|\
 (ldb_di1)| |
 (ipp_di0)| |- G 
 (ipp_di1)| | ^ ^ ipu1_di0
(ipu1_di0_pre)|/ ipu1_di0_sel

This diagram is drawn from the code in clk-imx6.c, and it does not
agree with what is in the SoC manuals - this is the representation
redrawn from the manuals:

--|\
--| |
--| |--+-- G 
--| |  ^ ldb_di0_sel   |^ ldb serial
--|/ (clks 33) |
   `-- /3.5  /2 -+---
  ^   ^ ldb_di0_podf |  ^ ldb di
  ldb_di0_div_3_5|
   .-'
   |
   '--|\
 (ldb_di1)| |
 (ipp_di0)| |- G 
 (ipp_di1)| | ^ ^ ipu1_di0
(ipu1_di0_pre)|/ ipu1_di0_sel


The difference is, there is no clock gate between the LDB DI clock and
the /7 divider, but there is a clock gate on the LDB serial clock.

In another location, the iMX6QDL manual suggests that it may be more
like this:

--|\
--| |
--| |--- cg ---+-
--| |  ^ ldb_di0_sel   |^ ldb serial
--|/ (clks 33) |
   `-- /3.5  /2 -+---
  ^   ^ ldb_di0_podf |  ^ ldb di
  ldb_di0_div_3_5|
   .-'
   |
   '--|\
 (ldb_di1)| |
 (ipp_di0)| |
 (ipp_di1)| | ^ ^ ipu1_di0
(ipu1_di0_pre)-- cg --|/ ipu1_di0_sel

although cg is not defined what it is.  Another place seems to
confirm the above diagram, saying that the ldb_di0_clk_enable
gating bits controls both ch_0_serial_clk (presumably the
ldb serial clock) and di_0_clk_nc (presumably the ldb di clock.
If that's correct cg refers to the clock gating via the CCM_CCGR
registers, which appear in the CCM clock tree diagram under LPCG.

So... I wonder which one of these three is actually the right one...

-- 
FTTC broadband for 0.8mile line: now at 9.7Mbps down 460kbps up... slowly
improving, and getting towards what was expected from it.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] Staging: rtl8192e: dot11d: Fixed coding style issues

2014-06-10 Thread Greg KH
On Tue, Jun 10, 2014 at 10:33:51PM +0530, Raghavendra wrote:
 Replaced 'printk' with 'netdev_info' and 'netdev_err' wherever necessary.
 Also fixed the coding issue cooresponding to line gap after the declarations.

Please don't do multiple things in the same patch, a single patch should
only do 1 thing.  So break this up into multiple patches.

 Signed-off-by: Raghavendra ar...@cdac.in

I need full name for a signed-off-by: line, please read
Documentation/SubmittingPatches for the details.

thanks,

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


Re: [PATCH] imx-drm: imx-hdmi: fix hdmi hotplug detection initial state

2014-06-10 Thread Fabio Estevam
On Tue, Jun 10, 2014 at 2:04 PM, Russell King - ARM Linux
li...@arm.linux.org.uk wrote:

 This diagram is drawn from the code in clk-imx6.c, and it does not
 agree with what is in the SoC manuals - this is the representation
 redrawn from the manuals:


 The difference is, there is no clock gate between the LDB DI clock and
 the /7 divider, but there is a clock gate on the LDB serial clock.

This is the correct version. i.MX 6Dual/6Quad Applications Processor
Reference Manual - Rev. 1, 04/2013 shows it incorrectly though.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: r8192ee: avoid leaking format string

2014-06-10 Thread Kees Cook
This makes sure a format string cannot leak into the work queue name nor
the printk buffer.

Signed-off-by: Kees Cook keesc...@chromium.org
---
 drivers/staging/rtl8192ee/base.c   |2 +-
 drivers/staging/rtl8192ee/btcoexist/halbtcoutsrc.h |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8192ee/base.c b/drivers/staging/rtl8192ee/base.c
index 64ade216a153..a7c69f704623 100644
--- a/drivers/staging/rtl8192ee/base.c
+++ b/drivers/staging/rtl8192ee/base.c
@@ -469,7 +469,7 @@ static void _rtl_init_deferred_work(struct ieee80211_hw *hw)
rtl92e_easy_concurrent_retrytimer_callback, (unsigned 
long)hw);
/* 2 work queue */
rtlpriv-works.hw = hw;
-   rtlpriv-works.rtl_wq = alloc_workqueue(rtlpriv-cfg-name, 0, 0);
+   rtlpriv-works.rtl_wq = alloc_workqueue(%s, 0, 0, rtlpriv-cfg-name);
INIT_DELAYED_WORK(rtlpriv-works.watchdog_wq,
  (void *)rtl92e_watchdog_wq_callback);
INIT_DELAYED_WORK(rtlpriv-works.ips_nic_off_wq,
diff --git a/drivers/staging/rtl8192ee/btcoexist/halbtcoutsrc.h 
b/drivers/staging/rtl8192ee/btcoexist/halbtcoutsrc.h
index c0a4286430a5..1231b16205f2 100644
--- a/drivers/staging/rtl8192ee/btcoexist/halbtcoutsrc.h
+++ b/drivers/staging/rtl8192ee/btcoexist/halbtcoutsrc.h
@@ -94,7 +94,7 @@ extern u32 btc_92edbg_type[];
 
 
 #defineCL_SPRINTF  snprintf
-#defineCL_PRINTF   printk
+#defineCL_PRINTF(buf)  printk(%s, buf)
 
 #defineBTC_PRINT(dbgtype, dbgflag, printstr, ...)  \
do {\
-- 
1.7.9.5


-- 
Kees Cook
Chrome OS Security
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2] Staging: bcm: Shortened lines

2014-06-10 Thread Matthias Beyer
This patch fixes line lengths in the

drivers/staging/bcm/InterfaceMisc.c

file.

Signed-off-by: Matthias Beyer m...@beyermatthias.de
---
 drivers/staging/bcm/InterfaceMisc.c | 98 +
 1 file changed, 67 insertions(+), 31 deletions(-)

diff --git a/drivers/staging/bcm/InterfaceMisc.c 
b/drivers/staging/bcm/InterfaceMisc.c
index 4173fd7..e001f2a 100644
--- a/drivers/staging/bcm/InterfaceMisc.c
+++ b/drivers/staging/bcm/InterfaceMisc.c
@@ -11,17 +11,24 @@ int InterfaceRDM(struct bcm_interface_adapter 
*psIntfAdapter,
return -EINVAL;
 
if (psIntfAdapter-psAdapter-device_removed == TRUE) {
-   BCM_DEBUG_PRINT(psIntfAdapter-psAdapter, DBG_TYPE_PRINTK, 0, 
0, Device got removed);
+   BCM_DEBUG_PRINT(psIntfAdapter-psAdapter, DBG_TYPE_PRINTK, 0, 0,
+   Device got removed);
return -ENODEV;
}
 
-   if ((psIntfAdapter-psAdapter-StopAllXaction == TRUE)  
(psIntfAdapter-psAdapter-chip_id = T3LPB)) {
-   BCM_DEBUG_PRINT(psIntfAdapter-psAdapter, DBG_TYPE_OTHERS, RDM, 
DBG_LVL_ALL, Currently Xaction is not allowed on the bus);
+   if ((psIntfAdapter-psAdapter-StopAllXaction == TRUE)
+(psIntfAdapter-psAdapter-chip_id = T3LPB)) {
+   BCM_DEBUG_PRINT(psIntfAdapter-psAdapter, DBG_TYPE_OTHERS, RDM,
+   DBG_LVL_ALL,
+   Currently Xaction is not allowed on the bus);
return -EACCES;
}
 
-   if (psIntfAdapter-bSuspended == TRUE || 
psIntfAdapter-bPreparingForBusSuspend == TRUE) {
-   BCM_DEBUG_PRINT(psIntfAdapter-psAdapter, DBG_TYPE_OTHERS, RDM, 
DBG_LVL_ALL, Bus is in suspended states hence RDM not allowed..);
+   if (psIntfAdapter-bSuspended == TRUE
+   || psIntfAdapter-bPreparingForBusSuspend == TRUE) {
+   BCM_DEBUG_PRINT(psIntfAdapter-psAdapter, DBG_TYPE_OTHERS, RDM,
+   DBG_LVL_ALL,
+   Bus is in suspended states hence RDM not 
allowed..);
return -EACCES;
}
psIntfAdapter-psAdapter-DeviceAccess = TRUE;
@@ -40,9 +47,11 @@ int InterfaceRDM(struct bcm_interface_adapter *psIntfAdapter,
psIntfAdapter-psAdapter-device_removed = TRUE;
 
if (bytes  0)
-   BCM_DEBUG_PRINT(psIntfAdapter-psAdapter, DBG_TYPE_OTHERS, RDM, 
DBG_LVL_ALL, RDM failed status :%d, bytes);
+   BCM_DEBUG_PRINT(psIntfAdapter-psAdapter, DBG_TYPE_OTHERS, RDM,
+   DBG_LVL_ALL, RDM failed status :%d, bytes);
else
-   BCM_DEBUG_PRINT(psIntfAdapter-psAdapter, DBG_TYPE_OTHERS, RDM, 
DBG_LVL_ALL, RDM sent %d, bytes);
+   BCM_DEBUG_PRINT(psIntfAdapter-psAdapter, DBG_TYPE_OTHERS, RDM,
+   DBG_LVL_ALL, RDM sent %d, bytes);
 
psIntfAdapter-psAdapter-DeviceAccess = false;
return bytes;
@@ -59,17 +68,24 @@ int InterfaceWRM(struct bcm_interface_adapter 
*psIntfAdapter,
return -EINVAL;
 
if (psIntfAdapter-psAdapter-device_removed == TRUE) {
-   BCM_DEBUG_PRINT(psIntfAdapter-psAdapter, DBG_TYPE_PRINTK, 0, 
0, Device got removed);
+   BCM_DEBUG_PRINT(psIntfAdapter-psAdapter, DBG_TYPE_PRINTK, 0, 0,
+   Device got removed);
return -ENODEV;
}
 
-   if ((psIntfAdapter-psAdapter-StopAllXaction == TRUE)  
(psIntfAdapter-psAdapter-chip_id = T3LPB)) {
-   BCM_DEBUG_PRINT(psIntfAdapter-psAdapter, DBG_TYPE_OTHERS, WRM, 
DBG_LVL_ALL, Currently Xaction is not allowed on the bus...);
+   if ((psIntfAdapter-psAdapter-StopAllXaction == TRUE)
+(psIntfAdapter-psAdapter-chip_id = T3LPB)) {
+   BCM_DEBUG_PRINT(psIntfAdapter-psAdapter, DBG_TYPE_OTHERS, WRM,
+   DBG_LVL_ALL,
+   Currently Xaction is not allowed on the 
bus...);
return -EACCES;
}
 
-   if (psIntfAdapter-bSuspended == TRUE || 
psIntfAdapter-bPreparingForBusSuspend == TRUE) {
-   BCM_DEBUG_PRINT(psIntfAdapter-psAdapter, DBG_TYPE_OTHERS, WRM, 
DBG_LVL_ALL, Bus is in suspended states hence RDM not allowed..);
+   if (psIntfAdapter-bSuspended == TRUE
+   || psIntfAdapter-bPreparingForBusSuspend == TRUE) {
+   BCM_DEBUG_PRINT(psIntfAdapter-psAdapter, DBG_TYPE_OTHERS, WRM,
+   DBG_LVL_ALL,
+   Bus is in suspended states hence RDM not 
allowed..);
return -EACCES;
}
 
@@ -89,12 +105,14 @@ int InterfaceWRM(struct bcm_interface_adapter 
*psIntfAdapter,
psIntfAdapter-psAdapter-device_removed = TRUE;
 
if (retval  0) {
-   BCM_DEBUG_PRINT(psIntfAdapter-psAdapter, DBG_TYPE_OTHERS, WRM, 

Re: [PATCH] imx-drm: imx-hdmi: fix hdmi hotplug detection initial state

2014-06-10 Thread Tim Harvey
On Mon, Jun 9, 2014 at 7:29 AM, Fabio Estevam feste...@gmail.com wrote:
 On Mon, Jun 9, 2014 at 11:06 AM, Russell King - ARM Linux
 li...@arm.linux.org.uk wrote:

 Please check the status in /sys/class/drm/card0-HDMI-A-1/status.  This
 should report the current state of the hotplug detection.

 /sys/class/drm/card0-HDMI-A-1/status returns the correct state for
 HDMI cable connection.

 Remember that this code detects off the HPD signal - if the HPD signal
 has not been correctly wired up, this patch is not going to help (really
 it comes down to a hardware fault, which I'm not trying to solve with
 this patch.)

 What I'm trying to resolve with this patch is that the state detected
 on properly wired up systems corresponds with the real initial state of
 the interface at initialisation time.

 The problem with the current code is that we start off assuming that the
 interface is disconnected, and we rely on an interrupt arriving to change
 that state.  If for whatever reason that interrupt does not arrive, then,
 even if the HPD signal is active, we continue believing that the interface
 is not connected.

 I seem to remember discussion in the past that the HPD signal is not
 wired up on SabreSD.  Really, this needs to be a DT flag to indicate

 It is sabrelite board that does not have HPD signal not wired up.

 sabresd does have HPD signal connected.

 The HDMI undetected issue I am seeing on sabresd seems to be related
 to the simultaneous usage of HDMI and LVDS.

 If I remove the ldb node from the imx6qdl-sabresd.dtsi, then the HDMI
 cable is correctly detected and HDMI is shown right after boot.

Fabio,

I'm following along with this thread as I see the same thing you do on
our Ventana boards that support both LVDS and HDMI: without
hot-plugging the HDMI connector I get not HDMI out simply by having
the LVDS node populated.

I am curious however how you are getting simultaneous display on both
LVDS and HDMI on a SabreSD board as the standard resistor loading
would make the EDID's of both conflict (which causes EDID read
failures) - perhaps you are using an LVDS display with no EDID or
perhaps you have modified the resistor loading on a SabreSD to move
them to different i2cs? Or is there some kernel param/config I don't
see to tell the imx_hdmi driver to ignore EDID and force in a mode?

Regards,

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


[PATCH 5/7] Staging: bcm: Merged some lines which got shorter by the latest patch

2014-06-10 Thread Matthias Beyer
Signed-off-by: Matthias Beyer m...@beyermatthias.de
---
 drivers/staging/bcm/InterfaceInit.c | 43 +++--
 1 file changed, 17 insertions(+), 26 deletions(-)

diff --git a/drivers/staging/bcm/InterfaceInit.c 
b/drivers/staging/bcm/InterfaceInit.c
index e334ca7..19e0f17 100644
--- a/drivers/staging/bcm/InterfaceInit.c
+++ b/drivers/staging/bcm/InterfaceInit.c
@@ -396,9 +396,8 @@ static int InterfaceAdapterInit(struct 
bcm_interface_adapter *psIntfAdapter)
psAd-interface_rdm = BcmRDM;
psAd-interface_wrm = BcmWRM;
 
-   bytes = rdmalt(psAd, CHIP_ID_REG,
-   (u32 *) (psAd-chip_id),
-   sizeof(u32));
+   bytes = rdmalt(psAd, CHIP_ID_REG, (u32 *) (psAd-chip_id),
+  sizeof(u32));
if (bytes  0) {
retval = bytes;
BCM_DEBUG_PRINT(psAd, DBG_TYPE_PRINTK, 0, 0,
@@ -410,7 +409,7 @@ static int InterfaceAdapterInit(struct 
bcm_interface_adapter *psIntfAdapter)
psAd-chip_id = ~0xF0;
 
dev_info(psIntfAdapter-udev-dev, RDM Chip ID 0x%lx\n,
-   psAd-chip_id);
+psAd-chip_id);
 
iface_desc = psIntfAdapter-interface-cur_altsetting;
 
@@ -422,26 +421,24 @@ static int InterfaceAdapterInit(struct 
bcm_interface_adapter *psIntfAdapter)
bBcm16 = TRUE;
 
dev_info(psIntfAdapter-udev-dev,
-   number of alternate setting %d\n,
-   psIntfAdapter-interface-num_altsetting);
+number of alternate setting %d\n,
+psIntfAdapter-interface-num_altsetting);
 
if (bBcm16 == TRUE) {
/* selecting alternate setting one as a default setting
 * for High Speed  modem. */
if (psIntfAdapter-bHighSpeedDevice)
retval = usb_set_interface(psIntfAdapter-udev,
-   DEFAULT_SETTING_0,
-   ALTERNATE_SETTING_1);
-   BCM_DEBUG_PRINT(psAd,
-   DBG_TYPE_INITEXIT, DRV_ENTRY,
+  DEFAULT_SETTING_0,
+  ALTERNATE_SETTING_1);
+   BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, DRV_ENTRY,
DBG_LVL_ALL,
BCM16 is applicable on this dongle\n);
if (retval || !psIntfAdapter-bHighSpeedDevice) {
usedIntOutForBulkTransfer = EP2;
endpoint = iface_desc-endpoint[EP2].desc;
-   BCM_DEBUG_PRINT(psAd,
-   DBG_TYPE_INITEXIT, DRV_ENTRY,
-   DBG_LVL_ALL,
+   BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT,
+   DRV_ENTRY, DBG_LVL_ALL,
Interface altsetting failed or 
modem is configured to Full Speed, hence will work on default setting 0\n);
/*
 * If Modem is high speed device EP2 should be
@@ -454,8 +451,7 @@ static int InterfaceAdapterInit(struct 
bcm_interface_adapter *psIntfAdapter)

!usb_endpoint_is_int_out(endpoint)) ||

(!psIntfAdapter-bHighSpeedDevice 
 
!usb_endpoint_is_bulk_out(endpoint))) {
-   BCM_DEBUG_PRINT(psAd,
-   DBG_TYPE_INITEXIT,
+   BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT,
DRV_ENTRY, DBG_LVL_ALL,
Configuring the 
EEPROM\n);
/* change the EP2, EP4 to INT OUT end 
point */
@@ -484,25 +480,21 @@ static int InterfaceAdapterInit(struct 
bcm_interface_adapter *psIntfAdapter)
usb_endpoint_is_bulk_out(endpoint)) {
/* Once BULK is selected in FS mode. 
Revert it back to INT. Else USB_IF will fail. */
UINT _uiData = ntohl(EP2_CFG_INT);
-   BCM_DEBUG_PRINT(psAd,
-   DBG_TYPE_INITEXIT,
+   BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT,
DRV_ENTRY, DBG_LVL_ALL,
  

[PATCH 6/7] Staging: bcm: Outsourced selecting of alternate setting

2014-06-10 Thread Matthias Beyer
This patch outsources a chunk of code which is for selecting an
alternate setting for highspeed modem into a new function.

Signed-off-by: Matthias Beyer m...@beyermatthias.de
---
 drivers/staging/bcm/InterfaceInit.c | 207 +++-
 1 file changed, 112 insertions(+), 95 deletions(-)

diff --git a/drivers/staging/bcm/InterfaceInit.c 
b/drivers/staging/bcm/InterfaceInit.c
index 19e0f17..a1fa3d5 100644
--- a/drivers/staging/bcm/InterfaceInit.c
+++ b/drivers/staging/bcm/InterfaceInit.c
@@ -374,6 +374,113 @@ static int device_run(struct bcm_interface_adapter 
*psIntfAdapter)
return 0;
 }
 
+static int select_alternate_setting_for_highspeed_modem(
+   struct bcm_interface_adapter *psIntfAdapter,
+   struct usb_endpoint_descriptor **endpoint,
+   const struct usb_host_interface *iface_desc,
+   int *usedIntOutForBulkTransfer)
+{
+   int retval = 0;
+   struct bcm_mini_adapter *psAd = psIntfAdapter-psAdapter;
+
+   /* selecting alternate setting one as a default setting
+* for High Speed  modem. */
+   if (psIntfAdapter-bHighSpeedDevice)
+   retval = usb_set_interface(psIntfAdapter-udev,
+  DEFAULT_SETTING_0,
+  ALTERNATE_SETTING_1);
+   BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, DRV_ENTRY,
+   DBG_LVL_ALL,
+   BCM16 is applicable on this dongle\n);
+   if (retval || !psIntfAdapter-bHighSpeedDevice) {
+   *usedIntOutForBulkTransfer = EP2;
+   *endpoint = iface_desc-endpoint[EP2].desc;
+   BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT,
+   DRV_ENTRY, DBG_LVL_ALL,
+   Interface altsetting failed or modem is 
configured to Full Speed, hence will work on default setting 0\n);
+   /*
+* If Modem is high speed device EP2 should be
+* INT OUT End point
+*
+* If Mode is FS then EP2 should be bulk end
+* point
+*/
+   if ((psIntfAdapter-bHighSpeedDevice 
+   !usb_endpoint_is_int_out(*endpoint)) ||
+   (!psIntfAdapter-bHighSpeedDevice 
+!usb_endpoint_is_bulk_out(*endpoint))) {
+   BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT,
+   DRV_ENTRY, DBG_LVL_ALL,
+   Configuring the EEPROM\n);
+   /* change the EP2, EP4 to INT OUT end point */
+   ConfigureEndPointTypesThroughEEPROM(
+   psAd);
+
+   /*
+* It resets the device and if any thing
+* gets changed in USB descriptor it
+* will show fail and re-enumerate the
+* device
+*/
+   retval = usb_reset_device(
+   psIntfAdapter-udev);
+   if (retval) {
+   BCM_DEBUG_PRINT(psAd,
+   DBG_TYPE_INITEXIT,
+   DRV_ENTRY,
+   DBG_LVL_ALL,
+   reset failed.  Re-enumerating 
the device.\n);
+   return retval;
+   }
+
+   }
+   if (!psIntfAdapter-bHighSpeedDevice 
+   usb_endpoint_is_bulk_out(*endpoint)) {
+   /* Once BULK is selected in FS mode. Revert it back to 
INT. Else USB_IF will fail. */
+   UINT _uiData = ntohl(EP2_CFG_INT);
+   BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT,
+   DRV_ENTRY, DBG_LVL_ALL,
+   Reverting Bulk to INT as it is in Full 
Speed mode.\n);
+   BeceemEEPROMBulkWrite(psAd,
+   (PUCHAR)  _uiData,
+   0x136, 4, TRUE);
+   }
+   } else {
+   *usedIntOutForBulkTransfer = EP4;
+   *endpoint = iface_desc-endpoint[EP4].desc;
+   BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT,
+   DRV_ENTRY, DBG_LVL_ALL,
+   Choosing AltSetting as a default setting.\n);
+   if (!usb_endpoint_is_int_out(*endpoint)) {
+   BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT,
+   DRV_ENTRY, DBG_LVL_ALL,
+   Dongle does not have BCM16 Fix.\n);
+   /* change the EP2, EP4 to 

[PATCH 1/7] Staging: bcm: Shortened some lines

2014-06-10 Thread Matthias Beyer
Signed-off-by: Matthias Beyer m...@beyermatthias.de
---
 drivers/staging/bcm/InterfaceInit.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/bcm/InterfaceInit.c 
b/drivers/staging/bcm/InterfaceInit.c
index 7c04c73..d61a688 100644
--- a/drivers/staging/bcm/InterfaceInit.c
+++ b/drivers/staging/bcm/InterfaceInit.c
@@ -70,7 +70,8 @@ static void InterfaceAdapterFree(struct bcm_interface_adapter 
*psIntfAdapter)
AdapterFree(psIntfAdapter-psAdapter);
 }
 
-static void ConfigureEndPointTypesThroughEEPROM(struct bcm_mini_adapter 
*Adapter)
+static void ConfigureEndPointTypesThroughEEPROM(
+   struct bcm_mini_adapter *Adapter)
 {
u32 ulReg;
int bytes;
@@ -147,7 +148,8 @@ static void ConfigureEndPointTypesThroughEEPROM(struct 
bcm_mini_adapter *Adapter
BeceemEEPROMBulkWrite(Adapter, (PUCHAR)ulReg, 0x1C2, 4, TRUE);
 }
 
-static int usbbcm_device_probe(struct usb_interface *intf, const struct 
usb_device_id *id)
+static int usbbcm_device_probe(struct usb_interface *intf,
+  const struct usb_device_id *id)
 {
struct usb_device *udev = interface_to_usbdev(intf);
int retval;
-- 
2.0.0

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


[PATCH 7/7] Staging: bcm: Shortened some lines in select_alternate_setting_for_highspeed_modem()

2014-06-10 Thread Matthias Beyer
Signed-off-by: Matthias Beyer m...@beyermatthias.de
---
 drivers/staging/bcm/InterfaceInit.c | 47 ++---
 1 file changed, 18 insertions(+), 29 deletions(-)

diff --git a/drivers/staging/bcm/InterfaceInit.c 
b/drivers/staging/bcm/InterfaceInit.c
index a1fa3d5..ea19436 100644
--- a/drivers/staging/bcm/InterfaceInit.c
+++ b/drivers/staging/bcm/InterfaceInit.c
@@ -389,14 +389,12 @@ static int select_alternate_setting_for_highspeed_modem(
retval = usb_set_interface(psIntfAdapter-udev,
   DEFAULT_SETTING_0,
   ALTERNATE_SETTING_1);
-   BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, DRV_ENTRY,
-   DBG_LVL_ALL,
+   BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL,
BCM16 is applicable on this dongle\n);
if (retval || !psIntfAdapter-bHighSpeedDevice) {
*usedIntOutForBulkTransfer = EP2;
*endpoint = iface_desc-endpoint[EP2].desc;
-   BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT,
-   DRV_ENTRY, DBG_LVL_ALL,
+   BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL,
Interface altsetting failed or modem is 
configured to Full Speed, hence will work on default setting 0\n);
/*
 * If Modem is high speed device EP2 should be
@@ -409,8 +407,8 @@ static int select_alternate_setting_for_highspeed_modem(
!usb_endpoint_is_int_out(*endpoint)) ||
(!psIntfAdapter-bHighSpeedDevice 
 !usb_endpoint_is_bulk_out(*endpoint))) {
-   BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT,
-   DRV_ENTRY, DBG_LVL_ALL,
+   BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, DRV_ENTRY,
+   DBG_LVL_ALL,
Configuring the EEPROM\n);
/* change the EP2, EP4 to INT OUT end point */
ConfigureEndPointTypesThroughEEPROM(
@@ -422,13 +420,10 @@ static int select_alternate_setting_for_highspeed_modem(
 * will show fail and re-enumerate the
 * device
 */
-   retval = usb_reset_device(
-   psIntfAdapter-udev);
+   retval = usb_reset_device(psIntfAdapter-udev);
if (retval) {
-   BCM_DEBUG_PRINT(psAd,
-   DBG_TYPE_INITEXIT,
-   DRV_ENTRY,
-   DBG_LVL_ALL,
+   BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT,
+   DRV_ENTRY, DBG_LVL_ALL,
reset failed.  Re-enumerating 
the device.\n);
return retval;
}
@@ -438,26 +433,23 @@ static int select_alternate_setting_for_highspeed_modem(
usb_endpoint_is_bulk_out(*endpoint)) {
/* Once BULK is selected in FS mode. Revert it back to 
INT. Else USB_IF will fail. */
UINT _uiData = ntohl(EP2_CFG_INT);
-   BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT,
-   DRV_ENTRY, DBG_LVL_ALL,
+   BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, DRV_ENTRY,
+   DBG_LVL_ALL,
Reverting Bulk to INT as it is in Full 
Speed mode.\n);
-   BeceemEEPROMBulkWrite(psAd,
-   (PUCHAR)  _uiData,
-   0x136, 4, TRUE);
+   BeceemEEPROMBulkWrite(psAd, (PUCHAR)  _uiData, 0x136,
+ 4, TRUE);
}
} else {
*usedIntOutForBulkTransfer = EP4;
*endpoint = iface_desc-endpoint[EP4].desc;
-   BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT,
-   DRV_ENTRY, DBG_LVL_ALL,
+   BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL,
Choosing AltSetting as a default setting.\n);
if (!usb_endpoint_is_int_out(*endpoint)) {
-   BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT,
-   DRV_ENTRY, DBG_LVL_ALL,
+   BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, DRV_ENTRY,
+   DBG_LVL_ALL,
Dongle does not have BCM16 Fix.\n);
   

[PATCH 2/7] Staging: bcm: replaced member accessing by variable

2014-06-10 Thread Matthias Beyer
Signed-off-by: Matthias Beyer m...@beyermatthias.de
---
 drivers/staging/bcm/InterfaceInit.c | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/bcm/InterfaceInit.c 
b/drivers/staging/bcm/InterfaceInit.c
index d61a688..539f830 100644
--- a/drivers/staging/bcm/InterfaceInit.c
+++ b/drivers/staging/bcm/InterfaceInit.c
@@ -28,28 +28,28 @@ static int InterfaceAdapterInit(struct 
bcm_interface_adapter *Adapter);
 static void InterfaceAdapterFree(struct bcm_interface_adapter *psIntfAdapter)
 {
int i = 0;
+   struct bcm_mini_adapter *psAd = psIntfAdapter-psAdapter;
 
/* Wake up the wait_queue... */
-   if (psIntfAdapter-psAdapter-LEDInfo.led_thread_running 
+   if (psAd-LEDInfo.led_thread_running 
BCM_LED_THREAD_RUNNING_ACTIVELY) {
-   psIntfAdapter-psAdapter-DriverState = DRIVER_HALT;
-   wake_up(psIntfAdapter-psAdapter-LEDInfo.notify_led_event);
+   psAd-DriverState = DRIVER_HALT;
+   wake_up(psAd-LEDInfo.notify_led_event);
}
-   reset_card_proc(psIntfAdapter-psAdapter);
+   reset_card_proc(psAd);
 
/*
 * worst case time taken by the RDM/WRM will be 5 sec. will check after
 * every 100 ms to accertain the device is not being accessed. After
 * this No RDM/WRM should be made.
 */
-   while (psIntfAdapter-psAdapter-DeviceAccess) {
-   BCM_DEBUG_PRINT(psIntfAdapter-psAdapter, DBG_TYPE_INITEXIT,
-   DRV_ENTRY, DBG_LVL_ALL,
+   while (psAd-DeviceAccess) {
+   BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL,
Device is being accessed.\n);
msleep(100);
}
/* Free interrupt URB */
-   /* psIntfAdapter-psAdapter-device_removed = TRUE; */
+   /* psAd-device_removed = TRUE; */
usb_free_urb(psIntfAdapter-psInterruptUrb);
 
/* Free transmit URBs */
@@ -67,7 +67,7 @@ static void InterfaceAdapterFree(struct bcm_interface_adapter 
*psIntfAdapter)
psIntfAdapter-asUsbRcb[i].urb = NULL;
}
}
-   AdapterFree(psIntfAdapter-psAdapter);
+   AdapterFree(psAd);
 }
 
 static void ConfigureEndPointTypesThroughEEPROM(
-- 
2.0.0

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


[PATCH 0/7] Cleanup patches for bcm staging driver

2014-06-10 Thread Matthias Beyer
Hi,

I did some cleanup patches on the

drivers/staging/bcm/InterfaceInit.c

file. I hope you like them.

The cleanup contains:

* Line shortenings
* Merging of multi-line statements which fit in one line
* Replacing member-accessing with variables
* Outsourcing a code junk into a seperate function

Please notice: I cannot test these patches. I compiled them successfully, but
for testing I do not have the appropriate hardware.

Kind regards,
Matthias Beyer

Matthias Beyer (7):
  Staging: bcm: Shortened some lines
  Staging: bcm: replaced member accessing by variable
  Staging: bcm: Replaced member accessing with variable in device_run()
  Staging: bcm: Replaced member accessing with variable in
InterfaceAdapterInit()
  Staging: bcm: Merged some lines which got shorter by the latest patch
  Staging: bcm: Outsourced selecting of alternate setting
  Staging: bcm: Shortened some lines in
select_alternate_setting_for_highspeed_modem()

 drivers/staging/bcm/InterfaceInit.c | 284 ++--
 1 file changed, 141 insertions(+), 143 deletions(-)

-- 
2.0.0

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


[PATCH 3/7] Staging: bcm: Replaced member accessing with variable in device_run()

2014-06-10 Thread Matthias Beyer
Signed-off-by: Matthias Beyer m...@beyermatthias.de
---
 drivers/staging/bcm/InterfaceInit.c | 20 +---
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/bcm/InterfaceInit.c 
b/drivers/staging/bcm/InterfaceInit.c
index 539f830..ab4c65a 100644
--- a/drivers/staging/bcm/InterfaceInit.c
+++ b/drivers/staging/bcm/InterfaceInit.c
@@ -340,16 +340,16 @@ static int device_run(struct bcm_interface_adapter 
*psIntfAdapter)
 {
int value = 0;
UINT status = STATUS_SUCCESS;
+   struct bcm_mini_adapter *psAd = psIntfAdapter-psAdapter;
 
-   status = InitCardAndDownloadFirmware(psIntfAdapter-psAdapter);
+   status = InitCardAndDownloadFirmware(psAd);
if (status != STATUS_SUCCESS) {
pr_err(DRV_NAME InitCardAndDownloadFirmware failed.\n);
return status;
}
-   if (psIntfAdapter-psAdapter-fw_download_done) {
+   if (psAd-fw_download_done) {
if (StartInterruptUrb(psIntfAdapter)) {
-   BCM_DEBUG_PRINT(psIntfAdapter-psAdapter,
-   DBG_TYPE_INITEXIT, DRV_ENTRY,
+   BCM_DEBUG_PRINT(psAd, DBG_TYPE_INITEXIT, DRV_ENTRY,
DBG_LVL_ALL,
Cannot send interrupt in URB\n);
}
@@ -358,17 +358,15 @@ static int device_run(struct bcm_interface_adapter 
*psIntfAdapter)
 * now register the cntrl interface.  after downloading the f/w
 * waiting for 5 sec to get the mailbox interrupt.
 */
-   psIntfAdapter-psAdapter-waiting_to_fw_download_done = false;
-   value = wait_event_timeout(
-   
psIntfAdapter-psAdapter-ioctl_fw_dnld_wait_queue,
-   
psIntfAdapter-psAdapter-waiting_to_fw_download_done,
-   5 * HZ);
+   psAd-waiting_to_fw_download_done = false;
+   value = wait_event_timeout(psAd-ioctl_fw_dnld_wait_queue,
+  psAd-waiting_to_fw_download_done,
+  5 * HZ);
 
if (value == 0)
pr_err(DRV_NAME : Timeout waiting for mailbox 
interrupt.\n);
 
-   if (register_control_device_interface(
-   psIntfAdapter-psAdapter)  0) {
+   if (register_control_device_interface(psAd)  0) {
pr_err(DRV_NAME : Register Control Device failed.\n);
return -EIO;
}
-- 
2.0.0

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


[PATCH 4/7] Staging: bcm: Replaced member accessing with variable in InterfaceAdapterInit()

2014-06-10 Thread Matthias Beyer
Signed-off-by: Matthias Beyer m...@beyermatthias.de
---
 drivers/staging/bcm/InterfaceInit.c | 53 +++--
 1 file changed, 27 insertions(+), 26 deletions(-)

diff --git a/drivers/staging/bcm/InterfaceInit.c 
b/drivers/staging/bcm/InterfaceInit.c
index ab4c65a..e334ca7 100644
--- a/drivers/staging/bcm/InterfaceInit.c
+++ b/drivers/staging/bcm/InterfaceInit.c
@@ -385,6 +385,7 @@ static int InterfaceAdapterInit(struct 
bcm_interface_adapter *psIntfAdapter)
bool bBcm16 = false;
UINT uiData = 0;
int bytes;
+   struct bcm_mini_adapter *psAd = psIntfAdapter-psAdapter;
 
/* Store the usb dev into interface adapter */
psIntfAdapter-udev =
@@ -392,31 +393,31 @@ static int InterfaceAdapterInit(struct 
bcm_interface_adapter *psIntfAdapter)
 
psIntfAdapter-bHighSpeedDevice =
(psIntfAdapter-udev-speed == USB_SPEED_HIGH);
-   psIntfAdapter-psAdapter-interface_rdm = BcmRDM;
-   psIntfAdapter-psAdapter-interface_wrm = BcmWRM;
+   psAd-interface_rdm = BcmRDM;
+   psAd-interface_wrm = BcmWRM;
 
-   bytes = rdmalt(psIntfAdapter-psAdapter, CHIP_ID_REG,
-   (u32 *) (psIntfAdapter-psAdapter-chip_id),
+   bytes = rdmalt(psAd, CHIP_ID_REG,
+   (u32 *) (psAd-chip_id),
sizeof(u32));
if (bytes  0) {
retval = bytes;
-   BCM_DEBUG_PRINT(psIntfAdapter-psAdapter, DBG_TYPE_PRINTK, 0, 0,
+   BCM_DEBUG_PRINT(psAd, DBG_TYPE_PRINTK, 0, 0,
CHIP ID Read Failed\n);
return retval;
}
 
-   if (0xbece3200 == (psIntfAdapter-psAdapter-chip_id  ~(0xF0)))
-   psIntfAdapter-psAdapter-chip_id = ~0xF0;
+   if (0xbece3200 == (psAd-chip_id  ~(0xF0)))
+   psAd-chip_id = ~0xF0;
 
dev_info(psIntfAdapter-udev-dev, RDM Chip ID 0x%lx\n,
-   psIntfAdapter-psAdapter-chip_id);
+   psAd-chip_id);
 
iface_desc = psIntfAdapter-interface-cur_altsetting;
 
-   if (psIntfAdapter-psAdapter-chip_id == T3B) {
+   if (psAd-chip_id == T3B) {
/* T3B device will have EEPROM, check if EEPROM is proper and
 * BCM16 can be done or not. */
-   BeceemEEPROMBulkRead(psIntfAdapter-psAdapter, uiData, 0x0, 4);
+   BeceemEEPROMBulkRead(psAd, uiData, 0x0, 4);
if (uiData == BECM)
bBcm16 = TRUE;
 
@@ -431,14 +432,14 @@ static int InterfaceAdapterInit(struct 
bcm_interface_adapter *psIntfAdapter)
retval = usb_set_interface(psIntfAdapter-udev,
DEFAULT_SETTING_0,
ALTERNATE_SETTING_1);
-   BCM_DEBUG_PRINT(psIntfAdapter-psAdapter,
+   BCM_DEBUG_PRINT(psAd,
DBG_TYPE_INITEXIT, DRV_ENTRY,
DBG_LVL_ALL,
BCM16 is applicable on this dongle\n);
if (retval || !psIntfAdapter-bHighSpeedDevice) {
usedIntOutForBulkTransfer = EP2;
endpoint = iface_desc-endpoint[EP2].desc;
-   BCM_DEBUG_PRINT(psIntfAdapter-psAdapter,
+   BCM_DEBUG_PRINT(psAd,
DBG_TYPE_INITEXIT, DRV_ENTRY,
DBG_LVL_ALL,
Interface altsetting failed or 
modem is configured to Full Speed, hence will work on default setting 0\n);
@@ -453,13 +454,13 @@ static int InterfaceAdapterInit(struct 
bcm_interface_adapter *psIntfAdapter)

!usb_endpoint_is_int_out(endpoint)) ||

(!psIntfAdapter-bHighSpeedDevice 
 
!usb_endpoint_is_bulk_out(endpoint))) {
-   
BCM_DEBUG_PRINT(psIntfAdapter-psAdapter,
+   BCM_DEBUG_PRINT(psAd,
DBG_TYPE_INITEXIT,
DRV_ENTRY, DBG_LVL_ALL,
Configuring the 
EEPROM\n);
/* change the EP2, EP4 to INT OUT end 
point */
ConfigureEndPointTypesThroughEEPROM(
-   
psIntfAdapter-psAdapter);
+   psAd);
 
/*
 * It resets the device and if any thing
@@ -470,7 +471,7 

Re: [PATCH] imx-drm: imx-hdmi: fix hdmi hotplug detection initial state

2014-06-10 Thread Fabio Estevam
Hi Tim,

On Tue, Jun 10, 2014 at 3:54 PM, Tim Harvey thar...@gateworks.com wrote:

 Fabio,

 I'm following along with this thread as I see the same thing you do on
 our Ventana boards that support both LVDS and HDMI: without
 hot-plugging the HDMI connector I get not HDMI out simply by having
 the LVDS node populated.

 I am curious however how you are getting simultaneous display on both
 LVDS and HDMI on a SabreSD board as the standard resistor loading
 would make the EDID's of both conflict (which causes EDID read
 failures) - perhaps you are using an LVDS display with no EDID or

Yes, there is no EDID in the LVDS I am using.

imxqdl-sabresd.dtsi declares the LVDS resolution to be 1024x768 and it
never changes.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 3/6] Staging: bcm: Lines shortened in ddr_init()

2014-06-10 Thread Matthias Beyer
Signed-off-by: Matthias Beyer m...@beyermatthias.de
---
 drivers/staging/bcm/DDRInit.c | 176 --
 1 file changed, 134 insertions(+), 42 deletions(-)

diff --git a/drivers/staging/bcm/DDRInit.c b/drivers/staging/bcm/DDRInit.c
index 4c7f518..cfaa2c1 100644
--- a/drivers/staging/bcm/DDRInit.c
+++ b/drivers/staging/bcm/DDRInit.c
@@ -818,15 +818,21 @@ int ddr_init(struct bcm_mini_adapter *Adapter)
if ((Adapter-chip_id !=  BCS220_2) 
(Adapter-chip_id !=  BCS220_2BC) 
(Adapter-chip_id != BCS220_3)) {
-   retval = rdmalt(Adapter, (UINT)0x0f000830, uiResetValue, 
sizeof(uiResetValue));
+   retval = rdmalt(Adapter, (UINT)0x0f000830, uiResetValue,
+   sizeof(uiResetValue));
if (retval  0) {
-   BCM_DEBUG_PRINT(Adapter, CMHOST, RDM, DBG_LVL_ALL, 
%s:%d RDM failed\n, __func__, __LINE__);
+   BCM_DEBUG_PRINT(Adapter, CMHOST, RDM, DBG_LVL_ALL,
+   %s:%d RDM failed\n,
+   __func__, __LINE__);
return retval;
}
uiResetValue |= 0x44;
-   retval = wrmalt(Adapter, (UINT)0x0f000830, uiResetValue, 
sizeof(uiResetValue));
+   retval = wrmalt(Adapter, (UINT)0x0f000830, uiResetValue,
+   sizeof(uiResetValue));
if (retval  0) {
-   BCM_DEBUG_PRINT(Adapter, CMHOST, RDM, DBG_LVL_ALL, 
%s:%d RDM failed\n, __func__, __LINE__);
+   BCM_DEBUG_PRINT(Adapter, CMHOST, RDM, DBG_LVL_ALL,
+   %s:%d RDM failed\n,
+   __func__, __LINE__);
return retval;
}
}
@@ -857,7 +863,8 @@ int ddr_init(struct bcm_mini_adapter *Adapter)
 
case DDR_160_MHZ:
psDDRSetting = asT3LPB_DDRSetting160MHz;
-   RegCount = 
sizeof(asT3LPB_DDRSetting160MHz)/sizeof(struct bcm_ddr_setting);
+   RegCount = sizeof(asT3LPB_DDRSetting160MHz) /
+  sizeof(struct bcm_ddr_setting);
 
if (Adapter-bMipsConfig == MIPS_200_MHZ)
uiClockSetting = 0x03F137D2;
@@ -871,7 +878,8 @@ int ddr_init(struct bcm_mini_adapter *Adapter)
case 0xbece0121:
case 0xbece0130:
case 0xbece0300:
-   BCM_DEBUG_PRINT(Adapter, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, 
DDR Setting: %x\n, Adapter-DDRSetting);
+   BCM_DEBUG_PRINT(Adapter, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL,
+   DDR Setting: %x\n, Adapter-DDRSetting);
switch (Adapter-DDRSetting) {
case DDR_80_MHZ:
psDDRSetting = asT3_DDRSetting80MHz;
@@ -933,15 +941,19 @@ int ddr_init(struct bcm_mini_adapter *Adapter)
}
 
value = 0;
-   BCM_DEBUG_PRINT(Adapter, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, 
Register Count is =%lu\n, RegCount);
+   BCM_DEBUG_PRINT(Adapter, DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL,
+   Register Count is =%lu\n, RegCount);
while (RegCount  !retval) {
-   if (uiClockSetting  psDDRSetting-ulRegAddress == 
MIPS_CLOCK_REG)
+   if (uiClockSetting
+psDDRSetting-ulRegAddress == MIPS_CLOCK_REG)
value = uiClockSetting;
else
value = psDDRSetting-ulRegValue;
-   retval = wrmalt(Adapter, psDDRSetting-ulRegAddress, value, 
sizeof(value));
+   retval = wrmalt(Adapter, psDDRSetting-ulRegAddress, value,
+   sizeof(value));
if (STATUS_SUCCESS != retval) {
-   BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, 
%s:%d\n, __func__, __LINE__);
+   BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0,
+   %s:%d\n, __func__, __LINE__);
break;
}
 
@@ -957,27 +969,47 @@ int ddr_init(struct bcm_mini_adapter *Adapter)
(Adapter-chip_id != BCS220_3)) {
/* drive MDDR to half in case of UMA-B: */
uiResetValue = 0x01010001;
-   retval = wrmalt(Adapter, (UINT)0x0F007018, 
uiResetValue, sizeof(uiResetValue));
+   retval = wrmalt(Adapter, (UINT)0x0F007018,
+   uiResetValue, sizeof(uiResetValue));
if (retval  0) {
-   BCM_DEBUG_PRINT(Adapter, CMHOST, RDM, 
DBG_LVL_ALL, %s:%d RDM failed\n, __func__, __LINE__);
+   BCM_DEBUG_PRINT(Adapter, CMHOST, RDM,
+   

[PATCH 6/6] Staging: bcm: Lines shortened in download_ddr_settings()

2014-06-10 Thread Matthias Beyer
Signed-off-by: Matthias Beyer m...@beyermatthias.de
---
 drivers/staging/bcm/DDRInit.c | 31 +--
 1 file changed, 21 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/bcm/DDRInit.c b/drivers/staging/bcm/DDRInit.c
index 423bfd9..4564f40 100644
--- a/drivers/staging/bcm/DDRInit.c
+++ b/drivers/staging/bcm/DDRInit.c
@@ -1159,7 +1159,8 @@ int download_ddr_settings(struct bcm_mini_adapter 
*Adapter)
 {
struct bcm_ddr_setting *psDDRSetting = NULL;
ULONG RegCount = 0;
-   unsigned long ul_ddr_setting_load_addr = 
DDR_DUMP_INTERNAL_DEVICE_MEMORY;
+   unsigned long ul_ddr_setting_load_addr =
+   DDR_DUMP_INTERNAL_DEVICE_MEMORY;
UINT value = 0;
int retval = STATUS_SUCCESS;
bool bOverrideSelfRefresh = false;
@@ -1283,18 +1284,22 @@ int download_ddr_settings(struct bcm_mini_adapter 
*Adapter)
}
/* total number of Register that has to be dumped */
value = RegCount;
-   retval = wrmalt(Adapter, ul_ddr_setting_load_addr, value, 
sizeof(value));
+   retval = wrmalt(Adapter, ul_ddr_setting_load_addr, value,
+   sizeof(value));
if (retval) {
-   BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, %s:%d\n, 
__func__, __LINE__);
+   BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0,
+   %s:%d\n, __func__, __LINE__);
 
return retval;
}
ul_ddr_setting_load_addr += sizeof(ULONG);
/* signature */
value = (0x1d1e0dd0);
-   retval = wrmalt(Adapter, ul_ddr_setting_load_addr, value, 
sizeof(value));
+   retval = wrmalt(Adapter, ul_ddr_setting_load_addr, value,
+   sizeof(value));
if (retval) {
-   BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, %s:%d\n, 
__func__, __LINE__);
+   BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0,
+   %s:%d\n, __func__, __LINE__);
return retval;
}
 
@@ -1303,17 +1308,23 @@ int download_ddr_settings(struct bcm_mini_adapter 
*Adapter)
 
while (RegCount  !retval) {
value = psDDRSetting-ulRegAddress;
-   retval = wrmalt(Adapter, ul_ddr_setting_load_addr, value, 
sizeof(value));
+   retval = wrmalt(Adapter, ul_ddr_setting_load_addr, value,
+   sizeof(value));
ul_ddr_setting_load_addr += sizeof(ULONG);
if (!retval) {
-   if (bOverrideSelfRefresh  (psDDRSetting-ulRegAddress 
== 0x0F007018))
+   if (bOverrideSelfRefresh
+(psDDRSetting-ulRegAddress
+   == 0x0F007018))
value = (psDDRSetting-ulRegValue | (18));
else
value = psDDRSetting-ulRegValue;
 
-   if (STATUS_SUCCESS != wrmalt(Adapter, 
ul_ddr_setting_load_addr,
-   value, sizeof(value))) {
-   BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, 
%s:%d\n, __func__, __LINE__);
+   if (STATUS_SUCCESS != wrmalt(Adapter,
+ul_ddr_setting_load_addr,
+value,
+sizeof(value))) {
+   BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0,
+   %s:%d\n, __func__, __LINE__);
break;
}
}
-- 
2.0.0

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


[PATCH 5/6] Staging: bcm: Moved doubled if-block

2014-06-10 Thread Matthias Beyer
This patch moves the doubled if block inside the retval-checking one
level up.

As the if-else-block it was in is now a one-statement if-else block,
I removed the braces from it.

Signed-off-by: Matthias Beyer m...@beyermatthias.de
---
 drivers/staging/bcm/DDRInit.c | 16 +---
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/bcm/DDRInit.c b/drivers/staging/bcm/DDRInit.c
index d13cb49..423bfd9 100644
--- a/drivers/staging/bcm/DDRInit.c
+++ b/drivers/staging/bcm/DDRInit.c
@@ -1306,21 +1306,15 @@ int download_ddr_settings(struct bcm_mini_adapter 
*Adapter)
retval = wrmalt(Adapter, ul_ddr_setting_load_addr, value, 
sizeof(value));
ul_ddr_setting_load_addr += sizeof(ULONG);
if (!retval) {
-   if (bOverrideSelfRefresh  (psDDRSetting-ulRegAddress 
== 0x0F007018)) {
+   if (bOverrideSelfRefresh  (psDDRSetting-ulRegAddress 
== 0x0F007018))
value = (psDDRSetting-ulRegValue | (18));
-   if (STATUS_SUCCESS != wrmalt(Adapter, 
ul_ddr_setting_load_addr,
-   value, sizeof(value))) {
-   BCM_DEBUG_PRINT(Adapter, 
DBG_TYPE_PRINTK, 0, 0, %s:%d\n, __func__, __LINE__);
-   break;
-   }
-   } else {
+   else
value = psDDRSetting-ulRegValue;
 
-   if (STATUS_SUCCESS != wrmalt(Adapter, 
ul_ddr_setting_load_addr,
+   if (STATUS_SUCCESS != wrmalt(Adapter, 
ul_ddr_setting_load_addr,
value, sizeof(value))) {
-   BCM_DEBUG_PRINT(Adapter, 
DBG_TYPE_PRINTK, 0, 0, %s:%d\n, __func__, __LINE__);
-   break;
-   }
+   BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, 
%s:%d\n, __func__, __LINE__);
+   break;
}
}
ul_ddr_setting_load_addr += sizeof(ULONG);
-- 
2.0.0

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


[PATCH 0/6] Cleanup patches for bcm staging driver, DDRInit.c file

2014-06-10 Thread Matthias Beyer
Hi,

These are some patches for the

drivers/staging/bcm/DDRInit.c

file.

The patchset contains:

* Indention/Whitespace fixes
* Line length fixes
* Simplifying of logic

Please notice: I'm not able to test these patches, as I do not have the
appropriate hardware. I compiled them, at least.

Kind regards,
Matthias Beyer

Matthias Beyer (6):
  Staging: bcm: Misc whitespace fixes
  Staging: bcm: Indentation fixes
  Staging: bcm: Lines shortened in ddr_init()
  Staging: bcm: Fixed indention for inner if-block
  Staging: bcm: Moved doubled if-block
  Staging: bcm: Lines shortened in download_ddr_settings()

 drivers/staging/bcm/DDRInit.c | 279 --
 1 file changed, 188 insertions(+), 91 deletions(-)

-- 
2.0.0

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


[PATCH 2/6] Staging: bcm: Indentation fixes

2014-06-10 Thread Matthias Beyer
This patch fixes some indentation errors, where multi-line statements
where not indented.

Signed-off-by: Matthias Beyer m...@beyermatthias.de
---
 drivers/staging/bcm/DDRInit.c | 56 +--
 1 file changed, 28 insertions(+), 28 deletions(-)

diff --git a/drivers/staging/bcm/DDRInit.c b/drivers/staging/bcm/DDRInit.c
index b4f0ea3..4c7f518 100644
--- a/drivers/staging/bcm/DDRInit.c
+++ b/drivers/staging/bcm/DDRInit.c
@@ -785,18 +785,18 @@ int ddr_init(struct bcm_mini_adapter *Adapter)
switch (Adapter-DDRSetting) {
case DDR_80_MHZ:
psDDRSetting = asT3LP_DDRSetting80MHz;
-   RegCount = (sizeof(asT3LP_DDRSetting80MHz)/
-   sizeof(struct bcm_ddr_setting));
+   RegCount = (sizeof(asT3LP_DDRSetting80MHz) /
+   sizeof(struct bcm_ddr_setting));
break;
case DDR_100_MHZ:
psDDRSetting = asT3LP_DDRSetting100MHz;
-   RegCount = (sizeof(asT3LP_DDRSetting100MHz)/
-   sizeof(struct bcm_ddr_setting));
+   RegCount = (sizeof(asT3LP_DDRSetting100MHz) /
+   sizeof(struct bcm_ddr_setting));
break;
case DDR_133_MHZ:
psDDRSetting = asT3LP_DDRSetting133MHz;
-   RegCount = (sizeof(asT3LP_DDRSetting133MHz)/
-   sizeof(struct bcm_ddr_setting));
+   RegCount = (sizeof(asT3LP_DDRSetting133MHz) /
+   sizeof(struct bcm_ddr_setting));
if (Adapter-bMipsConfig == MIPS_200_MHZ)
uiClockSetting = 0x03F13652;
else
@@ -836,18 +836,18 @@ int ddr_init(struct bcm_mini_adapter *Adapter)
 
case DDR_80_MHZ:
psDDRSetting = asT3LPB_DDRSetting80MHz;
-   RegCount = (sizeof(asT3B_DDRSetting80MHz)/
-   sizeof(struct bcm_ddr_setting));
+   RegCount = (sizeof(asT3B_DDRSetting80MHz) /
+   sizeof(struct bcm_ddr_setting));
break;
case DDR_100_MHZ:
psDDRSetting = asT3LPB_DDRSetting100MHz;
-   RegCount = (sizeof(asT3B_DDRSetting100MHz)/
-   sizeof(struct bcm_ddr_setting));
+   RegCount = (sizeof(asT3B_DDRSetting100MHz) /
+   sizeof(struct bcm_ddr_setting));
break;
case DDR_133_MHZ:
psDDRSetting = asT3LPB_DDRSetting133MHz;
-   RegCount = (sizeof(asT3B_DDRSetting133MHz)/
-   sizeof(struct bcm_ddr_setting));
+   RegCount = (sizeof(asT3B_DDRSetting133MHz) /
+   sizeof(struct bcm_ddr_setting));
 
if (Adapter-bMipsConfig == MIPS_200_MHZ)
uiClockSetting = 0x03F13652;
@@ -875,18 +875,18 @@ int ddr_init(struct bcm_mini_adapter *Adapter)
switch (Adapter-DDRSetting) {
case DDR_80_MHZ:
psDDRSetting = asT3_DDRSetting80MHz;
-   RegCount = (sizeof(asT3_DDRSetting80MHz)/
-   sizeof(struct bcm_ddr_setting));
+   RegCount = (sizeof(asT3_DDRSetting80MHz) /
+   sizeof(struct bcm_ddr_setting));
break;
case DDR_100_MHZ:
psDDRSetting = asT3_DDRSetting100MHz;
-   RegCount = (sizeof(asT3_DDRSetting100MHz)/
-   sizeof(struct bcm_ddr_setting));
+   RegCount = (sizeof(asT3_DDRSetting100MHz) /
+   sizeof(struct bcm_ddr_setting));
break;
case DDR_133_MHZ:
psDDRSetting = asT3_DDRSetting133MHz;
-   RegCount = (sizeof(asT3_DDRSetting133MHz)/
-   sizeof(struct bcm_ddr_setting));
+   RegCount = (sizeof(asT3_DDRSetting133MHz) /
+   sizeof(struct bcm_ddr_setting));
break;
default:
return -EINVAL;
@@ -896,26 +896,26 @@ int ddr_init(struct bcm_mini_adapter *Adapter)
switch (Adapter-DDRSetting) {
case DDR_80_MHZ:
psDDRSetting = asT3B_DDRSetting80MHz;
-   RegCount = (sizeof(asT3B_DDRSetting80MHz)/
-   sizeof(struct bcm_ddr_setting));
+   RegCount = (sizeof(asT3B_DDRSetting80MHz) /
+   

[PATCH] staging: line6: do not return 0 from probe if no initialization done

2014-06-10 Thread Alexey Khoroshilov
There is a strange return 0 in line6_probe() before any initialization of
the module is done. It can lead to NULL pointer dereference in other functions.
The patch proposes to return -ENODEV in this case.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov khoroshi...@ispras.ru
---
 drivers/staging/line6/driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/line6/driver.c b/drivers/staging/line6/driver.c
index ef511c76a6e3..503b2d763595 100644
--- a/drivers/staging/line6/driver.c
+++ b/drivers/staging/line6/driver.c
@@ -663,7 +663,7 @@ static int line6_probe(struct usb_interface *interface,
case LINE6_DEVID_POCKETPOD:
switch (interface_number) {
case 0:
-   return 0;   /* this interface has no endpoints */
+   return -ENODEV; /* this interface has no endpoints */
case 1:
alternate = 0;
break;
-- 
1.9.1

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


Re: [PATCH] staging: usbip: stub_main.c: Cleaning up missing null-terminate after strncpy call

2014-06-10 Thread Rickard Strandqvist
Hi

True!
Sorry  :-(

But then one would either operate strcpy outright.

Or use strlcpy then the code would be:

/* strlcpy() handles not include \0 */
len = strlcpy(busid, buf + 4, BUSID_SIZE);

/* busid needs to include \0 termination */
if (!(len  BUSID_SIZE))
return -EINVAL;


Or should we just let it be, perhaps?


Kind regards
Rickard Strandqvist


2014-06-10 8:57 GMT+02:00 Dan Carpenter dan.carpen...@oracle.com:
 On Wed, Jun 04, 2014 at 11:39:49PM +0200, Rickard Strandqvist wrote:
 Added a guaranteed null-terminate after call to strncpy.

 This was partly found using a static code analysis program called cppcheck.


 We already knew that the string was NUL terminated because we checked
 strnlen() on the lines before.

 regards,
 dan carpenter

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


RE: [PATCH] Staging/comedi: Fixes static analysis warning raised by sparse

2014-06-10 Thread Hartley Sweeten
On Monday, June 09, 2014 10:48 PM, Dan Carpenter wrote:
 On Mon, Jun 09, 2014 at 09:24:35PM -0400, Marcos A. Di Pietro wrote:
 Fixes warning static analysis warning raised by sparse in 
 drivers/staging/comedi/drivers/ni_stc.h
 
 warning: shift too big (4294967295) for type int

 This warning seems wrong.  I don't even understand how it thinks the
 shift is too big. The patch doesn't make sense and it introduces a bug.

The warning is a bit annoying and I also haven't figured out why sparse
thinks the shift is too big.

Following is an alternate patch to fix the warning.

I'm not sure if this patch will apply to the current linux-next tree due to
a number of patches I am holding until after the merge and Greg opens
the staging tree again.

Please just consider this as a RFC. If it looks like a clean solution I will 
rebase
it and repost after Greg opens the staging tree.

---

From 2a0130631a70cf27195cb1b6bffd0af455dbe5dd Mon Sep 17 00:00:00 2001
From: H Hartley Sweeten hswee...@visionengravers.com
Date: Mon, 5 May 2014 10:23:32 -0700
Subject: [PATCH] staging: comedi: ni_stc.h: cleanup dma channel select

There are a number of inline functions in ni_stc.h that are used to
work out the bits needed to select a dma channel for the ai, ao, gpct,
and cdo subdevices.

Unfortunately, the ni_stc_dma_channel_select_bitfield() helper causes
a sparse warning:

drivers/staging/comedi/drivers/ni_stc.h:724:26: warning: shift too big 
(4294967295) for type int

As Dan Carpenter pointed out, this warning seems wrong, but it is
annoying.

The helper functions also have some BUG and BUG_ON statements that will
never happen.

For aesthetics, convert the helper functions to macros and remove the
BUG and BUG_ON code.

Simplify the users of the new macros in ni_mio_common.c.

Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com
Cc: Dan Carpenter dan.carpen...@oracle.com
Cc: Marcos A. Di Pietro marcos...@gmail.com
---
 drivers/staging/comedi/drivers/ni_mio_common.c | 72 --
 drivers/staging/comedi/drivers/ni_stc.h| 61 +-
 2 files changed, 47 insertions(+), 86 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c 
b/drivers/staging/comedi/drivers/ni_mio_common.c
index e934fd4..7daac1d 100644
--- a/drivers/staging/comedi/drivers/ni_mio_common.c
+++ b/drivers/staging/comedi/drivers/ni_mio_common.c
@@ -239,15 +239,17 @@ static inline void ni_set_bitfield(struct comedi_device 
*dev, int reg,
devpriv-stc_writew(dev, devpriv-io_bidirection_pin_reg,
IO_Bidirection_Pin_Register);
break;
-   case AI_AO_Select:
+   case NI_STC_AI_AO_SELECT_REG:
devpriv-ai_ao_select_reg = ~bit_mask;
devpriv-ai_ao_select_reg |= bit_values  bit_mask;
-   devpriv-writeb(dev, devpriv-ai_ao_select_reg, AI_AO_Select);
+   devpriv-writeb(dev, devpriv-ai_ao_select_reg,
+   NI_STC_AI_AO_SELECT_REG);
break;
-   case G0_G1_Select:
+   case NI_STC_G0_G1_SELECT_REG:
devpriv-g0_g1_select_reg = ~bit_mask;
devpriv-g0_g1_select_reg |= bit_values  bit_mask;
-   devpriv-writeb(dev, devpriv-g0_g1_select_reg, G0_G1_Select);
+   devpriv-writeb(dev, devpriv-g0_g1_select_reg,
+   NI_STC_G0_G1_SELECT_REG);
break;
default:
printk(Warning %s() called with invalid register\n, __func__);
@@ -262,67 +264,37 @@ static inline void ni_set_bitfield(struct comedi_device 
*dev, int reg,
 /* DMA channel setup */
 
 /* negative channel means no channel */
-static inline void ni_set_ai_dma_channel(struct comedi_device *dev, int 
channel)
+static inline void ni_set_ai_dma_channel(struct comedi_device *dev, int chan)
 {
-   unsigned bitfield;
-
-   if (channel = 0) {
-   bitfield =
-   (ni_stc_dma_channel_select_bitfield(channel) 
-AI_DMA_Select_Shift)  AI_DMA_Select_Mask;
-   } else {
-   bitfield = 0;
-   }
-   ni_set_bitfield(dev, AI_AO_Select, AI_DMA_Select_Mask, bitfield);
+   ni_set_bitfield(dev, NI_STC_AI_AO_SELECT_REG, NI_STC_AI_DMA_MASK,
+   (chan = 0) ? NI_STC_AI_DMA_CHAN(chan) : 0);
 }
 
 /* negative channel means no channel */
-static inline void ni_set_ao_dma_channel(struct comedi_device *dev, int 
channel)
+static inline void ni_set_ao_dma_channel(struct comedi_device *dev, int chan)
 {
-   unsigned bitfield;
-
-   if (channel = 0) {
-   bitfield =
-   (ni_stc_dma_channel_select_bitfield(channel) 
-AO_DMA_Select_Shift)  AO_DMA_Select_Mask;
-   } else {
-   bitfield = 0;
-   }
-   ni_set_bitfield(dev, AI_AO_Select, AO_DMA_Select_Mask, bitfield);
+   ni_set_bitfield(dev, NI_STC_AI_AO_SELECT_REG, NI_STC_AO_DMA_MASK,
+

[PATCH] Staging: rtl8192e: dot11d: Fixed coding style issues

2014-06-10 Thread A Raghavendra Rao
From: Raghavendra ar...@cdac.in

Fixed coding style issues

Signed-off-by: A Raghavendra Rao ar...@cdac.in
---
 drivers/staging/rtl8192e/dot11d.c |9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8192e/dot11d.c 
b/drivers/staging/rtl8192e/dot11d.c
index 53da610..ef9da86 100644
--- a/drivers/staging/rtl8192e/dot11d.c
+++ b/drivers/staging/rtl8192e/dot11d.c
@@ -49,6 +49,7 @@ static struct channel_list ChannelPlan[] = {
 void dot11d_init(struct rtllib_device *ieee)
 {
struct rt_dot11d_info *pDot11dInfo = GET_DOT11D_INFO(ieee);
+
pDot11dInfo-bEnabled = false;
 
pDot11dInfo-State = DOT11D_STATE_NONE;
@@ -133,12 +134,12 @@ void Dot11d_UpdateCountryIe(struct rtllib_device *dev, u8 
*pTaddr,
pTriple = (struct chnl_txpow_triple *)(pCoutryIe + 3);
for (i = 0; i  NumTriples; i++) {
if (MaxChnlNum = pTriple-FirstChnl) {
-   printk(KERN_INFO Dot11d_UpdateCountryIe(): Invalid 
country IE, skip it1\n);
+   netdev_info(dev-dev, Dot11d_UpdateCountryIe(): 
Invalid country IE, skip it1\n);
return;
}
if (MAX_CHANNEL_NUMBER  (pTriple-FirstChnl +
pTriple-NumChnls)) {
-   printk(KERN_INFO Dot11d_UpdateCountryIe(): Invalid 
country IE, skip it2\n);
+   netdev_info(dev-dev, Dot11d_UpdateCountryIe(): 
Invalid country IE, skip it2\n);
return;
}
 
@@ -165,7 +166,7 @@ u8 DOT11D_GetMaxTxPwrInDbm(struct rtllib_device *dev, u8 
Channel)
u8 MaxTxPwrInDbm = 255;
 
if (MAX_CHANNEL_NUMBER  Channel) {
-   printk(KERN_INFO DOT11D_GetMaxTxPwrInDbm(): Invalid 
Channel\n);
+   netdev_info(dev-dev, DOT11D_GetMaxTxPwrInDbm(): Invalid 
Channel\n);
return MaxTxPwrInDbm;
}
if (pDot11dInfo-channel_map[Channel])
@@ -204,7 +205,7 @@ int ToLegalChannel(struct rtllib_device *dev, u8 channel)
}
 
if (MAX_CHANNEL_NUMBER  channel) {
-   printk(KERN_ERR %s(): Invalid Channel\n, __func__);
+   netdev_err(dev-dev, %s(): Invalid Channel\n, __func__);
return default_chn;
}
 
-- 
1.7.9.5

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


Re: [PATCH 06/13] staging: rtl8188eu: Remove unused funtion _rtw_read_mem()

2014-06-10 Thread navin patidar
some times i get confused by one patch should do only one thing
policy, for example this patch removes
many other things along  _rtw_read_mem().
But you are also right it's much easier to review when they are all
folded together.
I'm glad, i did it right this time. :)

regards,
navin patidar

On Tue, Jun 10, 2014 at 12:58 PM, Dan Carpenter
dan.carpen...@oracle.com wrote:
 Thanks.  This is much nicer to review when they are all folded together
 like this.

 regards,
 dan carpenter

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


Re: [PATCH] Staging: rtl8192e: dot11d: Fixed coding style issues

2014-06-10 Thread Greg KH
On Wed, Jun 11, 2014 at 09:25:47AM +0530, A Raghavendra Rao wrote:
 From: Raghavendra ar...@cdac.in
 
 Fixed coding style issues

Which specific coding style issue?  Be exact please.

And don't try to fix more than one type of coding style issue at a
time...

 
 Signed-off-by: A Raghavendra Rao ar...@cdac.in

This name doesn't match the From: line :(

thanks,

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