RE: [RFC/PATCH 3/7] ARM: OMAP3: clock data: treat all AM35x devices the same

2012-01-06 Thread Hiremath, Vaibhav
 -Original Message-
 From: Hilman, Kevin
 Sent: Friday, January 06, 2012 5:34 AM
 To: Hiremath, Vaibhav
 Cc: linux-omap@vger.kernel.org; Paul Walmsley
 Subject: Re: [RFC/PATCH 3/7] ARM: OMAP3: clock data: treat all AM35x
 devices the same
 
 Hiremath, Vaibhav hvaib...@ti.com writes:
 
  -Original Message-
  From: Hilman, Kevin
  Sent: Thursday, January 05, 2012 6:47 AM
  To: linux-omap@vger.kernel.org
  Cc: Paul Walmsley; Hiremath, Vaibhav
  Subject: [RFC/PATCH 3/7] ARM: OMAP3: clock data: treat all AM35x
 devices
  the same
 
  The init for 3505/3517 specific clocks depends on the ordering of
  cpu_is checks, is error prone and confusing (there are 2 separate
  checks for cpu_is_omap3505()).
 
  Remove the 3505-specific checking since CK_3505 flag is not used, and
  treat all AM35x clocks the same.
 
  This means that the SGX clock (the only AM35x clkdev not currently
  flagged for 3505) will now be registered on 3505, but that is
  harmless.  That can be cleaned up when the clkdev nodes are removed in
  favor of them being registered by hwmod.
 
  [Hiremath, Vaibhav] How do you think we can use hwmod here?
 
 I haven't thought in detail about the exact fix for this, but it
 shouldn't be difficult. For example, it could be as simple as creating
 some more per-family hwmod lists of optional hwmods.  Then, during init,
 register them based on the feature flag.
 
 Longer term, it may be that we handle this using DT, but I'm not sure we
 will use DT to describe that level of SoC detail.
 
  Currently hwmod is also dependent on cpu_is_ to register respective
 modules.
 
 In mainline it is only done by CPU family (revision), not using cpu_is*
 
Yeah, I missed this point (was referring different code base).

Thanks,
Vaibhav

  I completely understand and agree to the fact that there may not be any
 harm
  due to this, but this means, iva will be always registered for 3505
 devices.
 
 Correct for today, but not difficult to remedy by fixing up the hwmod init.
 
 Kevin
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 1/4] OMAPDSS: HDMI: remove duplicate video interface code

2012-01-06 Thread mythripk
From: Mythri P K mythr...@ti.com

video interface structure is a duplicate structure with parameters which are
already present in ip_data config structure, Thus removing the structure and
modifying corresponding code.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c |   31 +++-
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h |7 --
 2 files changed, 8 insertions(+), 30 deletions(-)

diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c 
b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
index e1a6ce5..403d6fc 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
@@ -629,8 +629,7 @@ static void hdmi_core_av_packet_config(struct hdmi_ip_data 
*ip_data,
 }
 
 static void hdmi_wp_init(struct omap_video_timings *timings,
-   struct hdmi_video_format *video_fmt,
-   struct hdmi_video_interface *video_int)
+   struct hdmi_video_format *video_fmt)
 {
pr_debug(Enter hdmi_wp_init\n);
 
@@ -645,12 +644,6 @@ static void hdmi_wp_init(struct omap_video_timings 
*timings,
video_fmt-y_res = 0;
video_fmt-x_res = 0;
 
-   video_int-vsp = 0;
-   video_int-hsp = 0;
-
-   video_int-interlacing = 0;
-   video_int-tm = 0; /* HDMI_TIMING_SLAVE */
-
 }
 
 void ti_hdmi_4xxx_wp_video_start(struct hdmi_ip_data *ip_data, bool start)
@@ -687,17 +680,16 @@ static void hdmi_wp_video_config_format(struct 
hdmi_ip_data *ip_data,
hdmi_write_reg(hdmi_wp_base(ip_data), HDMI_WP_VIDEO_SIZE, l);
 }
 
-static void hdmi_wp_video_config_interface(struct hdmi_ip_data *ip_data,
-   struct hdmi_video_interface *video_int)
+static void hdmi_wp_video_config_interface(struct hdmi_ip_data *ip_data)
 {
u32 r;
pr_debug(Enter hdmi_wp_video_config_interface\n);
 
r = hdmi_read_reg(hdmi_wp_base(ip_data), HDMI_WP_VIDEO_CFG);
-   r = FLD_MOD(r, video_int-vsp, 7, 7);
-   r = FLD_MOD(r, video_int-hsp, 6, 6);
-   r = FLD_MOD(r, video_int-interlacing, 3, 3);
-   r = FLD_MOD(r, video_int-tm, 1, 0);
+   r = FLD_MOD(r, ip_data-cfg.timings.vsync_pol, 7, 7);
+   r = FLD_MOD(r, ip_data-cfg.timings.hsync_pol, 6, 6);
+   r = FLD_MOD(r, ip_data-cfg.interlace, 3, 3);
+   r = FLD_MOD(r, 1, 1, 0); /* HDMI_TIMING_MASTER_24BIT */
hdmi_write_reg(hdmi_wp_base(ip_data), HDMI_WP_VIDEO_CFG, r);
 }
 
@@ -725,15 +717,13 @@ void ti_hdmi_4xxx_basic_configure(struct hdmi_ip_data 
*ip_data)
/* HDMI */
struct omap_video_timings video_timing;
struct hdmi_video_format video_format;
-   struct hdmi_video_interface video_interface;
/* HDMI core */
struct hdmi_core_infoframe_avi avi_cfg;
struct hdmi_core_video_config v_core_cfg;
struct hdmi_core_packet_enable_repeat repeat_cfg;
struct hdmi_config *cfg = ip_data-cfg;
 
-   hdmi_wp_init(video_timing, video_format,
-   video_interface);
+   hdmi_wp_init(video_timing, video_format);
 
hdmi_core_init(v_core_cfg,
avi_cfg,
@@ -748,12 +738,7 @@ void ti_hdmi_4xxx_basic_configure(struct hdmi_ip_data 
*ip_data)
 
hdmi_wp_video_config_format(ip_data, video_format);
 
-   video_interface.vsp = cfg-timings.vsync_pol;
-   video_interface.hsp = cfg-timings.hsync_pol;
-   video_interface.interlacing = cfg-interlace;
-   video_interface.tm = 1 ; /* HDMI_TIMING_MASTER_24BIT */
-
-   hdmi_wp_video_config_interface(ip_data, video_interface);
+   hdmi_wp_video_config_interface(ip_data);
 
/*
 * configure core video part
diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h 
b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
index 2040956..914bec6 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
@@ -517,13 +517,6 @@ struct hdmi_video_format {
u32 x_res;  /* pixel per line */
 };
 
-struct hdmi_video_interface {
-   int vsp;/* Vsync polarity */
-   int hsp;/* Hsync polarity */
-   int interlacing;
-   int tm; /* Timing mode */
-};
-
 struct hdmi_audio_format {
enum hdmi_stereo_channels   stereo_channels;
u8  active_chnnls_msk;
-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 0/4] OMAPDSS: HDMI: Improve the timings logic in HDMI

2012-01-06 Thread mythripk
From: Mythri P K mythr...@ti.com

There are some duplicate timing structure which are not needed thus removing
them to clean the code.
Also the static mapped timing structure is quite complicated to add new
timings, so simplify it by using array indexed method.

changes since v3: Remove double call of function
changes since v2: Incorporate changes in find_timing function
changes since V1: change of hdmi_find_timing function to return pointer to the
timing struct rather than deep copy to timing structure passed as parameter
variable name change from temp to timing2 in comparator function.

Mythri P K (4):
  OMAPDSS: HDMI: remove duplicate video interface code
  OMAPDSS: HDMI: update static timing table
  OMAPDSS: HDMI: change the timing match logic
  OMAPDSS: HDMI: remove duplicate code and mode parameter

 drivers/video/omap2/dss/hdmi.c|  256 +
 drivers/video/omap2/dss/ti_hdmi.h |   14 +-
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c |   47 ++
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h |7 -
 4 files changed, 135 insertions(+), 189 deletions(-)

-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 3/4] OMAPDSS: HDMI: change the timing match logic

2012-01-06 Thread mythripk
From: Mythri P K mythr...@ti.com

Change the timing match logic, Instead of the statically mapped method
to get the corresponding timings for a given code and mode, move to a
simpler array indexed method. It  will help to scale up to add more
timings when needed.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/hdmi.c |  176 +---
 1 files changed, 76 insertions(+), 100 deletions(-)

diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index f76ae47..309b238 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -58,8 +58,6 @@
 #define EDID_SIZE_BLOCK0_TIMING_DESCRIPTOR 4
 #define EDID_SIZE_BLOCK1_TIMING_DESCRIPTOR 4
 
-#define OMAP_HDMI_TIMINGS_NB   34
-
 #define HDMI_DEFAULT_REGN 16
 #define HDMI_DEFAULT_REGM2 1
 
@@ -88,7 +86,7 @@ static struct {
  * map it to corresponding CEA or VESA index.
  */
 
-static const struct hdmi_config cea_vesa_timings[OMAP_HDMI_TIMINGS_NB] = {
+static const struct hdmi_config cea_timings[] = {
 { {640, 480, 25200, 96, 16, 48, 2, 10, 33, 0, 0, 0}, {1, HDMI_HDMI} },
 { {720, 480, 27027, 62, 16, 60, 6, 9, 30, 0, 0, 0}, {2, HDMI_HDMI} },
 { {1280, 720, 74250, 40, 110, 220, 5, 5, 20, 1, 1, 0}, {4, HDMI_HDMI} },
@@ -104,6 +102,8 @@ static const struct hdmi_config 
cea_vesa_timings[OMAP_HDMI_TIMINGS_NB] = {
 { {1920, 1080, 74250, 44, 638, 148, 5, 4, 36, 1, 1, 0}, {32, HDMI_HDMI} },
 { {2880, 480, 108108, 248, 64, 240, 6, 9, 30, 0, 0, 0}, {35, HDMI_HDMI} },
 { {2880, 576, 108000, 256, 48, 272, 5, 5, 39, 0, 0, 0}, {37, HDMI_HDMI} },
+};
+static const struct hdmi_config vesa_timings[] = {
 /* VESA From Here */
 { {640, 480, 25175, 96, 16, 48, 2 , 11, 31, 0, 0, 0}, {4, HDMI_DVI} },
 { {800, 600, 4, 128, 40, 88, 4 , 1, 23, 1, 1, 0}, {9, HDMI_DVI} },
@@ -126,39 +126,6 @@ static const struct hdmi_config 
cea_vesa_timings[OMAP_HDMI_TIMINGS_NB] = {
 { {1280, 720, 74250, 40, 110, 220, 5, 5, 20, 1, 1, 0}, {0x55, HDMI_DVI} }
 };
 
-/*
- * This is a static mapping array which maps the timing values
- * with corresponding CEA / VESA code
- */
-static const int code_index[OMAP_HDMI_TIMINGS_NB] = {
-   1, 19, 4, 2, 37, 6, 21, 20, 5, 16, 17, 29, 31, 35, 32,
-   /* --15 CEA 17-- vesa*/
-   4, 9, 0xE, 0x17, 0x1C, 0x27, 0x20, 0x23, 0x10, 0x2A,
-   0X2F, 0x3A, 0X51, 0X52, 0x16, 0x29, 0x39, 0x1B
-};
-
-/*
- * This is reverse static mapping which maps the CEA / VESA code
- * to the corresponding timing values
- */
-static const int code_cea[39] = {
-   -1,  0,  3,  3,  2,  8,  5,  5, -1, -1,
-   -1, -1, -1, -1, -1, -1,  9, 10, 10,  1,
-   7,   6,  6, -1, -1, -1, -1, -1, -1, 11,
-   11, 12, 14, -1, -1, 13, 13,  4,  4
-};
-
-static const int code_vesa[85] = {
-   -1, -1, -1, -1, 15, -1, -1, -1, -1, 16,
-   -1, -1, -1, -1, 17, -1, 23, -1, -1, -1,
-   -1, -1, 29, 18, -1, -1, -1, 32, 19, -1,
-   -1, -1, 21, -1, -1, 22, -1, -1, -1, 20,
-   -1, 30, 24, -1, -1, -1, -1, 25, -1, -1,
-   -1, -1, -1, -1, -1, -1, -1, 31, 26, -1,
-   -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-   -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-   -1, 27, 28, -1, 33};
-
 static int hdmi_runtime_get(void)
 {
int r;
@@ -188,82 +155,83 @@ int hdmi_init_display(struct omap_dss_device *dssdev)
return 0;
 }
 
-static int get_timings_index(void)
+static const struct hdmi_config *hdmi_find_timing(
+   const struct hdmi_config *timings_arr,
+   int len)
 {
-   int code;
+   int i;
 
-   if (hdmi.mode == 0)
-   code = code_vesa[hdmi.code];
-   else
-   code = code_cea[hdmi.code];
+   for (i = 0; i  len; i++) {
+   if (timings_arr[i].cm.code == hdmi.code)
+   return timings_arr[i];
+   }
+   return NULL;
+}
 
-   if (code == -1) {
-   /* HDMI code 4 corresponds to 640 * 480 VGA */
-   hdmi.code = 4;
-   /* DVI mode 1 corresponds to HDMI 0 to DVI */
-   hdmi.mode = HDMI_DVI;
+static const struct hdmi_config *hdmi_get_timings(void)
+{
+   const struct hdmi_config *arr;
+   int len;
+
+   if (hdmi.mode == HDMI_DVI) {
+   arr = vesa_timings;
+   len = ARRAY_SIZE(vesa_timings);
+   } else {
+   arr = cea_timings;
+   len = ARRAY_SIZE(cea_timings);
+   }
+
+   return hdmi_find_timing(arr, len);
+}
+
+static bool hdmi_timings_compare(struct omap_video_timings *timing1,
+   const struct hdmi_video_timings *timing2)
+{
+   int timing1_vsync, timing1_hsync, timing2_vsync, timing2_hsync;
+
+   if ((timing2-pixel_clock == timing1-pixel_clock) 
+   (timing2-x_res == timing1-x_res) 
+   (timing2-y_res == timing1-y_res)) {
+
+   timing2_hsync = timing2-hfp + timing2-hsw + timing2-hbp;
+   

[PATCH v4 2/4] OMAPDSS: HDMI: update static timing table

2012-01-06 Thread mythripk
From: Mythri P K mythr...@ti.com

Add the vsync polarity, hsync polarity, interlace to hdmi_video_timings.
Remove the now duplicate structure hdmi_timings.
update the static table structure in HDMI with CEA/VESA code and mode.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/hdmi.c|   96 ++--
 drivers/video/omap2/dss/ti_hdmi.h |   14 ++---
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c |   20 +++---
 3 files changed, 63 insertions(+), 67 deletions(-)

diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index c56378c..f76ae47 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -88,42 +88,42 @@ static struct {
  * map it to corresponding CEA or VESA index.
  */
 
-static const struct hdmi_timings cea_vesa_timings[OMAP_HDMI_TIMINGS_NB] = {
-   { {640, 480, 25200, 96, 16, 48, 2, 10, 33} , 0 , 0},
-   { {1280, 720, 74250, 40, 440, 220, 5, 5, 20}, 1, 1},
-   { {1280, 720, 74250, 40, 110, 220, 5, 5, 20}, 1, 1},
-   { {720, 480, 27027, 62, 16, 60, 6, 9, 30}, 0, 0},
-   { {2880, 576, 108000, 256, 48, 272, 5, 5, 39}, 0, 0},
-   { {1440, 240, 27027, 124, 38, 114, 3, 4, 15}, 0, 0},
-   { {1440, 288, 27000, 126, 24, 138, 3, 2, 19}, 0, 0},
-   { {1920, 540, 74250, 44, 528, 148, 5, 2, 15}, 1, 1},
-   { {1920, 540, 74250, 44, 88, 148, 5, 2, 15}, 1, 1},
-   { {1920, 1080, 148500, 44, 88, 148, 5, 4, 36}, 1, 1},
-   { {720, 576, 27000, 64, 12, 68, 5, 5, 39}, 0, 0},
-   { {1440, 576, 54000, 128, 24, 136, 5, 5, 39}, 0, 0},
-   { {1920, 1080, 148500, 44, 528, 148, 5, 4, 36}, 1, 1},
-   { {2880, 480, 108108, 248, 64, 240, 6, 9, 30}, 0, 0},
-   { {1920, 1080, 74250, 44, 638, 148, 5, 4, 36}, 1, 1},
-   /* VESA From Here */
-   { {640, 480, 25175, 96, 16, 48, 2 , 11, 31}, 0, 0},
-   { {800, 600, 4, 128, 40, 88, 4 , 1, 23}, 1, 1},
-   { {848, 480, 33750, 112, 16, 112, 8 , 6, 23}, 1, 1},
-   { {1280, 768, 79500, 128, 64, 192, 7 , 3, 20}, 1, 0},
-   { {1280, 800, 83500, 128, 72, 200, 6 , 3, 22}, 1, 0},
-   { {1360, 768, 85500, 112, 64, 256, 6 , 3, 18}, 1, 1},
-   { {1280, 960, 108000, 112, 96, 312, 3 , 1, 36}, 1, 1},
-   { {1280, 1024, 108000, 112, 48, 248, 3 , 1, 38}, 1, 1},
-   { {1024, 768, 65000, 136, 24, 160, 6, 3, 29}, 0, 0},
-   { {1400, 1050, 121750, 144, 88, 232, 4, 3, 32}, 1, 0},
-   { {1440, 900, 106500, 152, 80, 232, 6, 3, 25}, 1, 0},
-   { {1680, 1050, 146250, 176 , 104, 280, 6, 3, 30}, 1, 0},
-   { {1366, 768, 85500, 143, 70, 213, 3, 3, 24}, 1, 1},
-   { {1920, 1080, 148500, 44, 148, 80, 5, 4, 36}, 1, 1},
-   { {1280, 768, 68250, 32, 48, 80, 7, 3, 12}, 0, 1},
-   { {1400, 1050, 101000, 32, 48, 80, 4, 3, 23}, 0, 1},
-   { {1680, 1050, 119000, 32, 48, 80, 6, 3, 21}, 0, 1},
-   { {1280, 800, 79500, 32, 48, 80, 6, 3, 14}, 0, 1},
-   { {1280, 720, 74250, 40, 110, 220, 5, 5, 20}, 1, 1}
+static const struct hdmi_config cea_vesa_timings[OMAP_HDMI_TIMINGS_NB] = {
+{ {640, 480, 25200, 96, 16, 48, 2, 10, 33, 0, 0, 0}, {1, HDMI_HDMI} },
+{ {720, 480, 27027, 62, 16, 60, 6, 9, 30, 0, 0, 0}, {2, HDMI_HDMI} },
+{ {1280, 720, 74250, 40, 110, 220, 5, 5, 20, 1, 1, 0}, {4, HDMI_HDMI} },
+{ {1920, 540, 74250, 44, 88, 148, 5, 2, 15, 1, 1, 1}, {5, HDMI_HDMI} },
+{ {1440, 240, 27027, 124, 38, 114, 3, 4, 15, 0, 0, 1}, {6, HDMI_HDMI} },
+{ {1920, 1080, 148500, 44, 88, 148, 5, 4, 36, 1, 1, 0}, {16, HDMI_HDMI} },
+{ {720, 576, 27000, 64, 12, 68, 5, 5, 39, 0, 0, 0}, {17, HDMI_HDMI} },
+{ {1280, 720, 74250, 40, 440, 220, 5, 5, 20, 1, 1, 0}, {19, HDMI_HDMI} },
+{ {1920, 540, 74250, 44, 528, 148, 5, 2, 15, 1, 1, 1}, {20, HDMI_HDMI} },
+{ {1440, 288, 27000, 126, 24, 138, 3, 2, 19, 0, 0, 1}, {21, HDMI_HDMI} },
+{ {1440, 576, 54000, 128, 24, 136, 5, 5, 39, 0, 0, 0}, {29, HDMI_HDMI} },
+{ {1920, 1080, 148500, 44, 528, 148, 5, 4, 36, 1, 1, 0}, {31, HDMI_HDMI} },
+{ {1920, 1080, 74250, 44, 638, 148, 5, 4, 36, 1, 1, 0}, {32, HDMI_HDMI} },
+{ {2880, 480, 108108, 248, 64, 240, 6, 9, 30, 0, 0, 0}, {35, HDMI_HDMI} },
+{ {2880, 576, 108000, 256, 48, 272, 5, 5, 39, 0, 0, 0}, {37, HDMI_HDMI} },
+/* VESA From Here */
+{ {640, 480, 25175, 96, 16, 48, 2 , 11, 31, 0, 0, 0}, {4, HDMI_DVI} },
+{ {800, 600, 4, 128, 40, 88, 4 , 1, 23, 1, 1, 0}, {9, HDMI_DVI} },
+{ {848, 480, 33750, 112, 16, 112, 8 , 6, 23, 1, 1, 0}, {0xE, HDMI_DVI} },
+{ {1280, 768, 79500, 128, 64, 192, 7 , 3, 20, 1, 0, 0}, {0x17, HDMI_DVI} },
+{ {1280, 800, 83500, 128, 72, 200, 6 , 3, 22, 1, 0, 0}, {0x1C, HDMI_DVI} },
+{ {1360, 768, 85500, 112, 64, 256, 6 , 3, 18, 1, 1, 0}, {0x27, HDMI_DVI} },
+{ {1280, 960, 108000, 112, 96, 312, 3 , 1, 36, 1, 1, 0}, {0x20, HDMI_DVI} },
+{ {1280, 1024, 108000, 112, 48, 248, 3 , 1, 38, 1, 1, 0}, {0x23, HDMI_DVI} },
+{ {1024, 768, 65000, 136, 24, 160, 6, 3, 29, 0, 0, 0}, {0x10, HDMI_DVI} },
+{ {1400, 1050, 121750, 144, 88, 232, 4, 3, 32, 1, 0, 0}, {0x2A, HDMI_DVI} },
+{ {1440, 900, 106500, 152, 80, 232, 6, 3, 

[PATCH v4 4/4] OMAPDSS: HDMI: remove duplicate code and mode parameter

2012-01-06 Thread mythripk
From: Mythri P K mythr...@ti.com

code and mode parameters are already a part of the ip_data structure
so no need to keep the same parameters again in hdmi global structure.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/hdmi.c |   18 +++---
 1 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index 309b238..0caa1bb 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -66,8 +66,6 @@ static struct {
struct omap_display_platform_data *pdata;
struct platform_device *pdev;
struct hdmi_ip_data ip_data;
-   int code;
-   int mode;
 
struct clk *sys_clk;
 } hdmi;
@@ -162,7 +160,7 @@ static const struct hdmi_config *hdmi_find_timing(
int i;
 
for (i = 0; i  len; i++) {
-   if (timings_arr[i].cm.code == hdmi.code)
+   if (timings_arr[i].cm.code == hdmi.ip_data.cfg.cm.code)
return timings_arr[i];
}
return NULL;
@@ -173,7 +171,7 @@ static const struct hdmi_config *hdmi_get_timings(void)
const struct hdmi_config *arr;
int len;
 
-   if (hdmi.mode == HDMI_DVI) {
+   if (hdmi.ip_data.cfg.cm.mode == HDMI_DVI) {
arr = vesa_timings;
len = ARRAY_SIZE(vesa_timings);
} else {
@@ -313,9 +311,9 @@ static int hdmi_power_on(struct omap_dss_device *dssdev)
timing = hdmi_get_timings();
if (timing == NULL) {
/* HDMI code 4 corresponds to 640 * 480 VGA */
-   hdmi.code = 4;
+   hdmi.ip_data.cfg.cm.code = 4;
/* DVI mode 1 corresponds to HDMI 0 to DVI */
-   hdmi.mode = HDMI_DVI;
+   hdmi.ip_data.cfg.cm.mode = HDMI_DVI;
hdmi.ip_data.cfg = vesa_timings[0];
} else {
hdmi.ip_data.cfg = *timing;
@@ -339,8 +337,6 @@ static int hdmi_power_on(struct omap_dss_device *dssdev)
goto err;
}
 
-   hdmi.ip_data.cfg.cm.mode = hdmi.mode;
-   hdmi.ip_data.cfg.cm.code = hdmi.code;
hdmi.ip_data.ops-video_configure(hdmi.ip_data);
 
/* Make selection of HDMI in DSS */
@@ -400,8 +396,8 @@ void omapdss_hdmi_display_set_timing(struct omap_dss_device 
*dssdev)
struct hdmi_cm cm;
 
cm = hdmi_get_code(dssdev-panel.timings);
-   hdmi.code = cm.code;
-   hdmi.mode = cm.mode;
+   hdmi.ip_data.cfg.cm.code = cm.code;
+   hdmi.ip_data.cfg.cm.mode = cm.mode;
 
if (dssdev-state == OMAP_DSS_DISPLAY_ACTIVE) {
int r;
@@ -667,7 +663,7 @@ static int hdmi_audio_hw_params(struct hdmi_ip_data 
*ip_data,
 static int hdmi_audio_startup(struct snd_pcm_substream *substream,
  struct snd_soc_dai *dai)
 {
-   if (!hdmi.mode) {
+   if (!hdmi.ip_data.cfg.cm.mode) {
pr_err(Current video settings do not support audio.\n);
return -EIO;
}
-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 1/3] OMAPDSS: HDMI: Move Avi-infoframe struct to hdmi_ip_data

2012-01-06 Thread mythripk
From: Mythri P K mythr...@ti.com

With AVI infoframe various parameters of video stream such as
aspect ratio, quantization range, videocode etc will be indicated
from source to sink.Thus AVI information needs to be set/accessed
by the middle ware based on the video content.
Thus this parameter is now moved to the ip_data structure.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/ti_hdmi.h |   42 +
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c |8 +++---
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h |   40 ---
 3 files changed, 46 insertions(+), 44 deletions(-)

diff --git a/drivers/video/omap2/dss/ti_hdmi.h 
b/drivers/video/omap2/dss/ti_hdmi.h
index 26ec6d1..46e776c 100644
--- a/drivers/video/omap2/dss/ti_hdmi.h
+++ b/drivers/video/omap2/dss/ti_hdmi.h
@@ -113,6 +113,47 @@ struct ti_hdmi_ip_ops {
 
 };
 
+/*
+ * Refer to section 8.2 in HDMI 1.3 specification for
+ * details about infoframe databytes
+ */
+struct hdmi_core_infoframe_avi {
+   /* Y0, Y1 rgb,yCbCr */
+   u8  db1_format;
+   /* A0  Active information Present */
+   u8  db1_active_info;
+   /* B0, B1 Bar info data valid */
+   u8  db1_bar_info_dv;
+   /* S0, S1 scan information */
+   u8  db1_scan_info;
+   /* C0, C1 colorimetry */
+   u8  db2_colorimetry;
+   /* M0, M1 Aspect ratio (4:3, 16:9) */
+   u8  db2_aspect_ratio;
+   /* R0...R3 Active format aspect ratio */
+   u8  db2_active_fmt_ar;
+   /* ITC IT content. */
+   u8  db3_itc;
+   /* EC0, EC1, EC2 Extended colorimetry */
+   u8  db3_ec;
+   /* Q1, Q0 Quantization range */
+   u8  db3_q_range;
+   /* SC1, SC0 Non-uniform picture scaling */
+   u8  db3_nup_scaling;
+   /* VIC0..6 Video format identification */
+   u8  db4_videocode;
+   /* PR0..PR3 Pixel repetition factor */
+   u8  db5_pixel_repeat;
+   /* Line number end of top bar */
+   u16 db6_7_line_eoftop;
+   /* Line number start of bottom bar */
+   u16 db8_9_line_sofbottom;
+   /* Pixel number end of left bar */
+   u16 db10_11_pixel_eofleft;
+   /* Pixel number start of right bar */
+   u16 db12_13_pixel_sofright;
+};
+
 struct hdmi_ip_data {
void __iomem*base_wp;   /* HDMI wrapper */
unsigned long   core_sys_offset;
@@ -122,6 +163,7 @@ struct hdmi_ip_data {
const struct ti_hdmi_ip_ops *ops;
struct hdmi_config cfg;
struct hdmi_pll_info pll_data;
+   struct hdmi_core_infoframe_avi avi_cfg;
 };
 int ti_hdmi_4xxx_phy_enable(struct hdmi_ip_data *ip_data);
 void ti_hdmi_4xxx_phy_disable(struct hdmi_ip_data *ip_data);
diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c 
b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
index a229ae7..d9ddb6d 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
@@ -534,12 +534,12 @@ static void hdmi_core_video_config(struct hdmi_ip_data 
*ip_data,
HDMI_CORE_SYS_TMDS_CTRL, cfg-tclk_sel_clkmult, 6, 5);
 }
 
-static void hdmi_core_aux_infoframe_avi_config(struct hdmi_ip_data *ip_data,
-   struct hdmi_core_infoframe_avi info_avi)
+static void hdmi_core_aux_infoframe_avi_config(struct hdmi_ip_data *ip_data)
 {
u32 val;
char sum = 0, checksum = 0;
void __iomem *av_base = hdmi_av_base(ip_data);
+   struct hdmi_core_infoframe_avi info_avi = ip_data-avi_cfg;
 
sum += 0x82 + 0x002 + 0x00D;
hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_TYPE, 0x082);
@@ -718,7 +718,7 @@ void ti_hdmi_4xxx_basic_configure(struct hdmi_ip_data 
*ip_data)
struct omap_video_timings video_timing;
struct hdmi_video_format video_format;
/* HDMI core */
-   struct hdmi_core_infoframe_avi avi_cfg;
+   struct hdmi_core_infoframe_avi avi_cfg = ip_data-avi_cfg;
struct hdmi_core_video_config v_core_cfg;
struct hdmi_core_packet_enable_repeat repeat_cfg;
struct hdmi_config *cfg = ip_data-cfg;
@@ -780,7 +780,7 @@ void ti_hdmi_4xxx_basic_configure(struct hdmi_ip_data 
*ip_data)
avi_cfg.db10_11_pixel_eofleft = 0;
avi_cfg.db12_13_pixel_sofright = 0;
 
-   hdmi_core_aux_infoframe_avi_config(ip_data, avi_cfg);
+   hdmi_core_aux_infoframe_avi_config(ip_data);
 
/* enable/repeat the infoframe */
repeat_cfg.avi_infoframe = HDMI_PACKETENABLE;
diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h 
b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
index 004b418..a14d1a0 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
@@ -450,46 +450,6 @@ struct hdmi_core_video_config {
  * Refer to section 8.2 in HDMI 1.3 specification for
  * details about infoframe databytes
  */
-struct hdmi_core_infoframe_avi {
-   /* Y0, Y1 rgb,yCbCr */
-   u8  db1_format;
-   

[PATCH v3 3/3] OMAPDSS: HDMI: Sysfs support to configure quantization range

2012-01-06 Thread mythripk
From: Mythri P K mythr...@ti.com

Add sysfs support for the uset space to configure limited range or full range
quantization for HDMI.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/dss.h  |2 +
 drivers/video/omap2/dss/dss_features.c |1 +
 drivers/video/omap2/dss/hdmi.c |   28 +++
 drivers/video/omap2/dss/hdmi_panel.c   |   39 +++-
 drivers/video/omap2/dss/ti_hdmi.h  |2 +
 5 files changed, 71 insertions(+), 1 deletions(-)

diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index 3cf99a9..0b1b6f2 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -518,6 +518,8 @@ int omapdss_hdmi_display_check_timing(struct 
omap_dss_device *dssdev,
struct omap_video_timings *timings);
 int omapdss_hdmi_read_edid(u8 *buf, int len);
 bool omapdss_hdmi_detect(void);
+int omapdss_hdmi_get_range(void);
+int omapdss_hdmi_set_range(enum hdmi_range range);
 int hdmi_panel_init(void);
 void hdmi_panel_exit(void);
 
diff --git a/drivers/video/omap2/dss/dss_features.c 
b/drivers/video/omap2/dss/dss_features.c
index afcb593..544b172 100644
--- a/drivers/video/omap2/dss/dss_features.c
+++ b/drivers/video/omap2/dss/dss_features.c
@@ -476,6 +476,7 @@ static const struct ti_hdmi_ip_ops omap4_hdmi_functions = {
defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI_MODULE)
.audio_enable   =   ti_hdmi_4xxx_wp_audio_enable,
 #endif
+   .configure_range=   ti_hdmi_4xxx_configure_range,
 
 };
 
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index 92a6679..65397f7 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -384,6 +384,34 @@ static void hdmi_power_off(struct omap_dss_device *dssdev)
hdmi_runtime_put();
 }
 
+int omapdss_hdmi_set_range(enum hdmi_range range)
+{
+   int r = 0;
+   enum hdmi_range old_range;
+
+   old_range = hdmi.ip_data.range;
+   hdmi.ip_data.range = range;
+
+   /* HDMI 1.3 section 6.6 VGA (640x480) format requires Full Range */
+   if ((range == HDMI_LIMITED_RANGE) 
+   ((hdmi.ip_data.cfg.cm.code == 4 
+   hdmi.ip_data.cfg.cm.mode == HDMI_DVI) ||
+   (hdmi.ip_data.cfg.cm.code == 1 
+   hdmi.ip_data.cfg.cm.mode == HDMI_HDMI)))
+   return -EINVAL;
+
+   r = hdmi.ip_data.ops-configure_range(hdmi.ip_data);
+   if (r)
+   hdmi.ip_data.range = old_range;
+
+   return r;
+}
+
+int omapdss_hdmi_get_range(void)
+{
+   return hdmi.ip_data.range;
+}
+
 int omapdss_hdmi_display_check_timing(struct omap_dss_device *dssdev,
struct omap_video_timings *timings)
 {
diff --git a/drivers/video/omap2/dss/hdmi_panel.c 
b/drivers/video/omap2/dss/hdmi_panel.c
index 533d5dc..3166602 100644
--- a/drivers/video/omap2/dss/hdmi_panel.c
+++ b/drivers/video/omap2/dss/hdmi_panel.c
@@ -33,6 +33,37 @@ static struct {
struct mutex hdmi_lock;
 } hdmi;
 
+static ssize_t hdmi_range_show(struct device *dev,
+   struct device_attribute *attr, char *buf)
+{
+   int r;
+
+   r = omapdss_hdmi_get_range();
+   return snprintf(buf, PAGE_SIZE, %d\n, r);
+}
+
+static ssize_t hdmi_range_store(struct device *dev,
+   struct device_attribute *attr,
+   const char *buf, size_t size)
+{
+   unsigned long range;
+   int r ;
+
+   if (strncmp(limited, buf, 7) == 0)
+   range = 0;
+   else if (strncmp(full, buf, 4) == 0)
+   range = 1;
+   else
+   return -EINVAL;
+
+   r = omapdss_hdmi_set_range(range);
+   if (r)
+   return r;
+
+   return size;
+}
+
+static DEVICE_ATTR(range, S_IRUGO | S_IWUSR, hdmi_range_show, 
hdmi_range_store);
 
 static int hdmi_panel_probe(struct omap_dss_device *dssdev)
 {
@@ -41,6 +72,12 @@ static int hdmi_panel_probe(struct omap_dss_device *dssdev)
dssdev-panel.config = OMAP_DSS_LCD_TFT |
OMAP_DSS_LCD_IVS | OMAP_DSS_LCD_IHS;
 
+   /* sysfs entry to provide user space control to set
+* quantization range
+*/
+   if (device_create_file(dssdev-dev, dev_attr_range))
+   DSSERR(failed to create sysfs file\n);
+
dssdev-panel.timings = (struct omap_video_timings){640, 480, 25175, 
96, 16, 48, 2 , 11, 31};
 
DSSDBG(hdmi_panel_probe x_res= %d y_res = %d\n,
@@ -51,7 +88,7 @@ static int hdmi_panel_probe(struct omap_dss_device *dssdev)
 
 static void hdmi_panel_remove(struct omap_dss_device *dssdev)
 {
-
+   device_remove_file(dssdev-dev, dev_attr_range);
 }
 
 static int hdmi_panel_enable(struct omap_dss_device *dssdev)
diff --git a/drivers/video/omap2/dss/ti_hdmi.h 
b/drivers/video/omap2/dss/ti_hdmi.h
index ab0f2c2..9a31683 100644
--- a/drivers/video/omap2/dss/ti_hdmi.h
+++ 

[PATCH v3 2/3] OMAPDSS: HDMI: Add quantization range support in IP lib

2012-01-06 Thread mythripk
From: Mythri P K mythr...@ti.com

Configure the IP to support the limited range and full range quantization
mode. If the full range is configured HDMI transmitter will expand the range
of pixel data from 16-235 to full 8 bit 0-235.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/ti_hdmi.h |2 +
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c |   41 +
 include/video/omapdss.h   |5 +++
 3 files changed, 48 insertions(+), 0 deletions(-)

diff --git a/drivers/video/omap2/dss/ti_hdmi.h 
b/drivers/video/omap2/dss/ti_hdmi.h
index 46e776c..ab0f2c2 100644
--- a/drivers/video/omap2/dss/ti_hdmi.h
+++ b/drivers/video/omap2/dss/ti_hdmi.h
@@ -164,6 +164,7 @@ struct hdmi_ip_data {
struct hdmi_config cfg;
struct hdmi_pll_info pll_data;
struct hdmi_core_infoframe_avi avi_cfg;
+   enum hdmi_range range;
 };
 int ti_hdmi_4xxx_phy_enable(struct hdmi_ip_data *ip_data);
 void ti_hdmi_4xxx_phy_disable(struct hdmi_ip_data *ip_data);
@@ -181,4 +182,5 @@ void ti_hdmi_4xxx_phy_dump(struct hdmi_ip_data *ip_data, 
struct seq_file *s);
defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI_MODULE)
 void ti_hdmi_4xxx_wp_audio_enable(struct hdmi_ip_data *ip_data, bool enable);
 #endif
+int ti_hdmi_4xxx_configure_range(struct hdmi_ip_data *ip_data);
 #endif
diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c 
b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
index d9ddb6d..58c5782 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
@@ -610,6 +610,47 @@ static void hdmi_core_aux_infoframe_avi_config(struct 
hdmi_ip_data *ip_data)
hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_CHSUM, checksum);
 }
 
+int ti_hdmi_4xxx_configure_range(struct hdmi_ip_data *ip_data)
+{
+   int var;
+
+   switch (ip_data-range) {
+   /*
+* Setting the AVI infroframe to respective limited range
+* 0 if limited range 1 if full range
+*/
+   case HDMI_LIMITED_RANGE:
+   ip_data-avi_cfg.db3_q_range = HDMI_INFOFRAME_AVI_DB3Q_LR;
+   hdmi_core_aux_infoframe_avi_config(ip_data);
+   var = hdmi_read_reg(hdmi_core_sys_base(ip_data),
+   HDMI_CORE_SYS_VID_ACEN);
+   var = FLD_MOD(var, 1, 1, 1);
+   hdmi_write_reg(hdmi_core_sys_base(ip_data),
+   HDMI_CORE_SYS_VID_ACEN, var);
+   break;
+   case HDMI_FULL_RANGE:
+   /* HDMI 1.3 section 6.6 YCBCR components shall
+* always be Limited Range
+*/
+   if (ip_data-avi_cfg.db1_format ==
+   HDMI_INFOFRAME_AVI_DB1Y_YUV422) {
+   pr_err(Only limited range is supported for YUV);
+   return -EINVAL;
+   }
+   ip_data-avi_cfg.db3_q_range = HDMI_INFOFRAME_AVI_DB3Q_FR;
+   hdmi_core_aux_infoframe_avi_config(ip_data);
+   var = hdmi_read_reg(hdmi_core_sys_base(ip_data),
+   HDMI_CORE_SYS_VID_MODE);
+   var = FLD_MOD(var, 1, 4, 4);
+   hdmi_write_reg(hdmi_core_sys_base(ip_data),
+   HDMI_CORE_SYS_VID_MODE, var);
+   break;
+   default:
+   return -EINVAL;
+   }
+   return 0;
+}
+
 static void hdmi_core_av_packet_config(struct hdmi_ip_data *ip_data,
struct hdmi_core_packet_enable_repeat repeat_cfg)
 {
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index 062b3b2..29f4e78 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -204,6 +204,11 @@ enum omap_hdmi_flags {
OMAP_HDMI_SDA_SCL_EXTERNAL_PULLUP = 1  0,
 };
 
+enum hdmi_range {
+   HDMI_LIMITED_RANGE = 0,
+   HDMI_FULL_RANGE = 1,
+};
+
 /* RFBI */
 
 struct rfbi_timings {
-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 2/3] OMAPDSS: HDMI: Handle HPD event in ip

2012-01-06 Thread mythripk
From: Mythri P K mythr...@ti.com

HPD event is notified to ip file and based on the
notification appropriate action is taken. As the PHY
should be in LDO_ON state and not TX_ON (transmission),
this transition is handled in ip file.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/ti_hdmi.h |4 +++
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c |   31 
 2 files changed, 30 insertions(+), 5 deletions(-)

diff --git a/drivers/video/omap2/dss/ti_hdmi.h 
b/drivers/video/omap2/dss/ti_hdmi.h
index 9a31683..eba2ed4 100644
--- a/drivers/video/omap2/dss/ti_hdmi.h
+++ b/drivers/video/omap2/dss/ti_hdmi.h
@@ -113,6 +113,8 @@ struct ti_hdmi_ip_ops {
 
int (*configure_range)(struct hdmi_ip_data *ip_data);
 
+   int (*notify_hpd)(struct hdmi_ip_data *ip_data, int hpd_state);
+
 };
 
 /*
@@ -167,6 +169,7 @@ struct hdmi_ip_data {
struct hdmi_pll_info pll_data;
struct hdmi_core_infoframe_avi avi_cfg;
enum hdmi_range range;
+   bool hdmi_phy_tx_enabled;
 };
 int ti_hdmi_4xxx_phy_enable(struct hdmi_ip_data *ip_data);
 void ti_hdmi_4xxx_phy_disable(struct hdmi_ip_data *ip_data);
@@ -185,4 +188,5 @@ void ti_hdmi_4xxx_phy_dump(struct hdmi_ip_data *ip_data, 
struct seq_file *s);
 void ti_hdmi_4xxx_wp_audio_enable(struct hdmi_ip_data *ip_data, bool enable);
 #endif
 int ti_hdmi_4xxx_configure_range(struct hdmi_ip_data *ip_data);
+int ti_hdmi_4xxx_notify_hpd(struct hdmi_ip_data *ip_data, bool hpd_state);
 #endif
diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c 
b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
index 58c5782..10c845d 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
@@ -223,15 +223,11 @@ void ti_hdmi_4xxx_pll_disable(struct hdmi_ip_data 
*ip_data)
hdmi_set_pll_pwr(ip_data, HDMI_PLLPWRCMD_ALLOFF);
 }
 
-int ti_hdmi_4xxx_phy_enable(struct hdmi_ip_data *ip_data)
+int ti_hdmi_4xxx_phy_poweron(struct hdmi_ip_data *ip_data)
 {
u16 r = 0;
void __iomem *phy_base = hdmi_phy_base(ip_data);
 
-   r = hdmi_set_phy_pwr(ip_data, HDMI_PHYPWRCMD_LDOON);
-   if (r)
-   return r;
-
r = hdmi_set_phy_pwr(ip_data, HDMI_PHYPWRCMD_TXON);
if (r)
return r;
@@ -260,11 +256,36 @@ int ti_hdmi_4xxx_phy_enable(struct hdmi_ip_data *ip_data)
return 0;
 }
 
+int ti_hdmi_4xxx_phy_enable(struct hdmi_ip_data *ip_data)
+{
+   int r = 0;
+
+   r = hdmi_set_phy_pwr(ip_data, HDMI_PHYPWRCMD_LDOON);
+
+   return r;
+}
+
 void ti_hdmi_4xxx_phy_disable(struct hdmi_ip_data *ip_data)
 {
hdmi_set_phy_pwr(ip_data, HDMI_PHYPWRCMD_OFF);
 }
 
+int ti_hdmi_4xxx_notify_hpd(struct hdmi_ip_data *ip_data, bool hpd_state)
+{
+   int r = 0;
+
+   if (hpd_state != ip_data-hdmi_phy_tx_enabled) {
+   if (hpd_state)
+   r = ti_hdmi_4xxx_phy_poweron(ip_data);
+   else
+   r = ti_hdmi_4xxx_phy_enable(ip_data);
+   if (!r)
+   ip_data-hdmi_phy_tx_enabled = hpd_state;
+   }
+
+   return r;
+}
+
 static int hdmi_core_ddc_init(struct hdmi_ip_data *ip_data)
 {
void __iomem *base = hdmi_core_sys_base(ip_data);
-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 3/3] OMAPDSS: HDMI: HPD support added to HDMI driver

2012-01-06 Thread mythripk
From: Mythri P K mythr...@ti.com

GPIO based handling of connect/disconnect of the HDMI cable
(Hot-plug detect)is added to the HDMI driver.

Signed-off-by: Mythri P K mythr...@ti.com
---
 drivers/video/omap2/dss/dss_features.c |1 +
 drivers/video/omap2/dss/hdmi.c |   49 
 2 files changed, 50 insertions(+), 0 deletions(-)

diff --git a/drivers/video/omap2/dss/dss_features.c 
b/drivers/video/omap2/dss/dss_features.c
index 544b172..ef3f666 100644
--- a/drivers/video/omap2/dss/dss_features.c
+++ b/drivers/video/omap2/dss/dss_features.c
@@ -477,6 +477,7 @@ static const struct ti_hdmi_ip_ops omap4_hdmi_functions = {
.audio_enable   =   ti_hdmi_4xxx_wp_audio_enable,
 #endif
.configure_range=   ti_hdmi_4xxx_configure_range,
+   .notify_hpd =   ti_hdmi_4xxx_notify_hpd,
 
 };
 
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index 29de79f..4c3110d 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -66,6 +66,9 @@ static struct {
struct omap_display_platform_data *pdata;
struct platform_device *pdev;
struct hdmi_ip_data ip_data;
+   struct omap_dss_device *dssdev;
+
+   bool hpd;
 
struct clk *sys_clk;
 } hdmi;
@@ -461,6 +464,29 @@ void hdmi_dump_regs(struct seq_file *s)
mutex_unlock(hdmi.lock);
 }
 
+static int hdmi_get_current_hpd(void)
+{
+   return gpio_get_value(hdmi.dssdev-hpd_gpio);
+}
+
+static irqreturn_t hpd_enable_handler(int irq, void *ptr)
+{
+   DSSDBG(hpd enable %d\n, hdmi.hpd);
+
+   hdmi.ip_data.ops-notify_hpd(hdmi.ip_data, hdmi.hpd);
+
+   return IRQ_HANDLED;
+}
+
+static irqreturn_t hpd_irq_handler(int irq, void *ptr)
+{
+   if (hdmi.dssdev-state == OMAP_DSS_DISPLAY_ACTIVE) {
+   hdmi.hpd = hdmi_get_current_hpd();
+   return IRQ_WAKE_THREAD;
+   }
+   return IRQ_HANDLED;
+}
+
 int omapdss_hdmi_read_edid(u8 *buf, int len)
 {
int r;
@@ -782,11 +808,22 @@ static int omapdss_hdmihw_probe(struct platform_device 
*pdev)
 {
struct resource *hdmi_mem;
int r;
+   struct omap_dss_board_info *board_data;
 
hdmi.pdata = pdev-dev.platform_data;
hdmi.pdev = pdev;
 
mutex_init(hdmi.lock);
+   /* save reference to HDMI device */
+   board_data = hdmi.pdata-board_data;
+   for (r = 0; r  board_data-num_devices; r++) {
+   if (board_data-devices[r]-type == OMAP_DISPLAY_TYPE_HDMI)
+   hdmi.dssdev = board_data-devices[r];
+   }
+   if (!hdmi.dssdev) {
+   DSSERR(can't get HDMI device\n);
+   return -EINVAL;
+   }
 
hdmi_mem = platform_get_resource(hdmi.pdev, IORESOURCE_MEM, 0);
if (!hdmi_mem) {
@@ -810,6 +847,16 @@ static int omapdss_hdmihw_probe(struct platform_device 
*pdev)
 
pm_runtime_enable(pdev-dev);
 
+   r = request_threaded_irq(gpio_to_irq(hdmi.dssdev-hpd_gpio),
+   hpd_irq_handler, hpd_enable_handler,
+   IRQF_DISABLED | IRQF_TRIGGER_RISING |
+   IRQF_TRIGGER_FALLING, hpd, NULL);
+   if (r  0) {
+   pr_err(hdmi: request_irq %d failed\n,
+   gpio_to_irq(hdmi.dssdev-hpd_gpio));
+   return -EINVAL;
+   }
+
hdmi.ip_data.core_sys_offset = HDMI_CORE_SYS;
hdmi.ip_data.core_av_offset = HDMI_CORE_AV;
hdmi.ip_data.pll_offset = HDMI_PLLCTRL;
@@ -840,6 +887,8 @@ static int omapdss_hdmihw_remove(struct platform_device 
*pdev)
snd_soc_unregister_codec(pdev-dev);
 #endif
 
+   free_irq(gpio_to_irq(hdmi.dssdev-hpd_gpio), hpd_irq_handler);
+
pm_runtime_disable(pdev-dev);
 
hdmi_put_clocks();
-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/3] OMAPDSS: HDMI: HDMI Hot-plug detect support.

2012-01-06 Thread mythripk
From: Mythri P K mythr...@ti.com

HDMI phy should be in the LDO_ON state when cable is not connected.
Only when cable is connected and transmission is possible HDMI Phy should move
to TX_ON state.
This is supported by the Hot-plug feature.
Now when HDMI is enabled the following steps are followed:
-It registers to the GPIO irq handler
-If an HPD interrupt is received the corresponding IRQ handler is called where
it checks if it is a connect / disconnect based on which PHY is moved to
appropriate state.

Mythri P K (3):
  OMAPDSS: HDMI: HPD support in boardfile
  OMAPDSS: HDMI: Handle HPD event in ip
  OMAPDSS: HDMI: HPD support added to HDMI driver

 arch/arm/mach-omap2/board-4430sdp.c   |   37 +---
 arch/arm/mach-omap2/board-omap4panda.c|   37 +---
 arch/arm/mach-omap2/display.c |   21 --
 drivers/video/omap2/dss/dss_features.c|1 +
 drivers/video/omap2/dss/hdmi.c|   65 ++---
 drivers/video/omap2/dss/ti_hdmi.h |4 ++
 drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c |   31 +++--
 include/video/omapdss.h   |6 ++-
 8 files changed, 126 insertions(+), 76 deletions(-)

-- 
1.7.5.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 1/3] OMAPDSS: HDMI: HPD support in boardfile

2012-01-06 Thread mythripk
From: Mythri P K mythr...@ti.com

Add support for HPD GPIO configuration in board file.
Also remove the enabling  of GPIO's required for HDMI from
hdmi driver file to display.c based on the GPIO #'s sent from
board file.

Signed-off-by: Mythri P K mythr...@ti.com
Acked-by: Tony Lindgren t...@atomide.com
---
 arch/arm/mach-omap2/board-4430sdp.c|   37 ++-
 arch/arm/mach-omap2/board-omap4panda.c |   37 +--
 arch/arm/mach-omap2/display.c  |   21 ++---
 drivers/video/omap2/dss/hdmi.c |   16 +-
 include/video/omapdss.h|6 -
 5 files changed, 46 insertions(+), 71 deletions(-)

diff --git a/arch/arm/mach-omap2/board-4430sdp.c 
b/arch/arm/mach-omap2/board-4430sdp.c
index 4af874a..d6b647d 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -52,8 +52,9 @@
 #define ETH_KS8851_QUART   138
 #define OMAP4_SFH7741_SENSOR_OUTPUT_GPIO   184
 #define OMAP4_SFH7741_ENABLE_GPIO  188
-#define HDMI_GPIO_HPD 60 /* Hot plug pin for HDMI */
+#define HDMI_GPIO_CT_CP_HPD 60 /* Hot plug pin for HDMI */
 #define HDMI_GPIO_LS_OE 41 /* Level shifter for HDMI */
+#define HDMI_GPIO_HPD 63
 #define DISPLAY_SEL_GPIO   59  /* LCD2/PicoDLP switch */
 #define DLP_POWER_ON_GPIO  40
 
@@ -596,27 +597,11 @@ static void __init omap_sfh7741prox_init(void)
 }
 
 static struct gpio sdp4430_hdmi_gpios[] = {
-   { HDMI_GPIO_HPD,GPIOF_OUT_INIT_HIGH,hdmi_gpio_hpd   },
-   { HDMI_GPIO_LS_OE,  GPIOF_OUT_INIT_HIGH,hdmi_gpio_ls_oe },
+   { HDMI_GPIO_CT_CP_HPD,  GPIOF_OUT_INIT_HIGH,hdmi_gpio_ct_cp_hpd },
+   { HDMI_GPIO_LS_OE,  GPIOF_OUT_INIT_HIGH,hdmi_gpio_ls_oe },
+   { HDMI_GPIO_HPD,  GPIOF_DIR_IN,hdmi_gpio_hpd },
 };
 
-static int sdp4430_panel_enable_hdmi(struct omap_dss_device *dssdev)
-{
-   int status;
-
-   status = gpio_request_array(sdp4430_hdmi_gpios,
-   ARRAY_SIZE(sdp4430_hdmi_gpios));
-   if (status)
-   pr_err(%s: Cannot request HDMI GPIOs\n, __func__);
-
-   return status;
-}
-
-static void sdp4430_panel_disable_hdmi(struct omap_dss_device *dssdev)
-{
-   gpio_free(HDMI_GPIO_LS_OE);
-   gpio_free(HDMI_GPIO_HPD);
-}
 
 static struct nokia_dsi_panel_data dsi1_panel = {
.name   = taal,
@@ -735,9 +720,8 @@ static struct omap_dss_device sdp4430_hdmi_device = {
.name = hdmi,
.driver_name = hdmi_panel,
.type = OMAP_DISPLAY_TYPE_HDMI,
-   .platform_enable = sdp4430_panel_enable_hdmi,
-   .platform_disable = sdp4430_panel_disable_hdmi,
.channel = OMAP_DSS_CHANNEL_DIGIT,
+   .hpd_gpio = 63,
 };
 
 static struct picodlp_panel_data sdp4430_picodlp_pdata = {
@@ -830,10 +814,13 @@ static void omap_4430sdp_display_init(void)
 * OMAP4460SDP/Blaze and OMAP4430 ES2.3 SDP/Blaze boards and
 * later have external pull up on the HDMI I2C lines
 */
-   if (cpu_is_omap446x() || omap_rev()  OMAP4430_REV_ES2_2)
-   omap_hdmi_init(OMAP_HDMI_SDA_SCL_EXTERNAL_PULLUP);
+   if (cpu_is_omap446x() || (omap_rev()  OMAP4430_REV_ES2_2))
+   omap_hdmi_init(OMAP_HDMI_SDA_SCL_EXTERNAL_PULLUP, HDMI_GPIO_HPD,
+   sdp4430_hdmi_gpios,
+   ARRAY_SIZE(sdp4430_hdmi_gpios));
else
-   omap_hdmi_init(0);
+   omap_hdmi_init(0, HDMI_GPIO_HPD, sdp4430_hdmi_gpios,
+   ARRAY_SIZE(sdp4430_hdmi_gpios));
 }
 
 #ifdef CONFIG_OMAP_MUX
diff --git a/arch/arm/mach-omap2/board-omap4panda.c 
b/arch/arm/mach-omap2/board-omap4panda.c
index 00103e3..d60c674 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -51,8 +51,9 @@
 #define GPIO_HUB_NRESET62
 #define GPIO_WIFI_PMENA43
 #define GPIO_WIFI_IRQ  53
-#define HDMI_GPIO_HPD 60 /* Hot plug pin for HDMI */
+#define HDMI_GPIO_CT_CP_HPD 60 /* Hot plug pin for HDMI */
 #define HDMI_GPIO_LS_OE 41 /* Level shifter for HDMI */
+#define HDMI_GPIO_HPD 63
 
 /* wl127x BT, FM, GPS connectivity chip */
 static int wl1271_gpios[] = {46, -1, -1};
@@ -479,35 +480,17 @@ int __init omap4_panda_dvi_init(void)
 }
 
 static struct gpio panda_hdmi_gpios[] = {
-   { HDMI_GPIO_HPD,GPIOF_OUT_INIT_HIGH, hdmi_gpio_hpd   },
-   { HDMI_GPIO_LS_OE,  GPIOF_OUT_INIT_HIGH, hdmi_gpio_ls_oe },
+   { HDMI_GPIO_CT_CP_HPD,  GPIOF_OUT_INIT_HIGH,hdmi_gpio_ct_cp_hpd },
+   { HDMI_GPIO_LS_OE,  GPIOF_OUT_INIT_HIGH,hdmi_gpio_ls_oe },
+   { HDMI_GPIO_HPD,  GPIOF_DIR_IN,hdmi_gpio_hpd },
 };
 
-static int omap4_panda_panel_enable_hdmi(struct omap_dss_device *dssdev)
-{
-   int status;
-
-   status = gpio_request_array(panda_hdmi_gpios,
-   ARRAY_SIZE(panda_hdmi_gpios));
-  

Re: [PATCH v2 3/3] OMAPDSS: HDMI: Sysfs support to configure quantization

2012-01-06 Thread K, Mythri P
Hi Tomi,


On Thu, Jan 5, 2012 at 12:51 PM, Tomi Valkeinen tomi.valkei...@ti.com wrote:
 On Wed, 2012-01-04 at 17:23 +0530, mythr...@ti.com wrote:
 From: Mythri P K mythr...@ti.com

 Add sysfs support for the uset space to configure limited range or full range
 quantization for HDMI.

 Signed-off-by: Mythri P K mythr...@ti.com
 ---
  drivers/video/omap2/dss/dss.h          |    2 +
  drivers/video/omap2/dss/dss_features.c |    1 +
  drivers/video/omap2/dss/hdmi.c         |   28 +
  drivers/video/omap2/dss/hdmi_panel.c   |   35 
 +++-
  drivers/video/omap2/dss/ti_hdmi.h      |    2 +
  5 files changed, 67 insertions(+), 1 deletions(-)

 diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
 index 6308fc5..cf1f0f9 100644
 --- a/drivers/video/omap2/dss/dss.h
 +++ b/drivers/video/omap2/dss/dss.h
 @@ -498,6 +498,8 @@ int omapdss_hdmi_display_check_timing(struct 
 omap_dss_device *dssdev,
                                       struct omap_video_timings *timings);
  int omapdss_hdmi_read_edid(u8 *buf, int len);
  bool omapdss_hdmi_detect(void);
 +int omapdss_hdmi_get_range(void);
 +int omapdss_hdmi_set_range(int range);
  int hdmi_panel_init(void);
  void hdmi_panel_exit(void);

 diff --git a/drivers/video/omap2/dss/dss_features.c 
 b/drivers/video/omap2/dss/dss_features.c
 index b402699..c7e71b9 100644
 --- a/drivers/video/omap2/dss/dss_features.c
 +++ b/drivers/video/omap2/dss/dss_features.c
 @@ -465,6 +465,7 @@ static const struct ti_hdmi_ip_ops omap4_hdmi_functions 
 = {
       .dump_core              =       ti_hdmi_4xxx_core_dump,
       .dump_pll               =       ti_hdmi_4xxx_pll_dump,
       .dump_phy               =       ti_hdmi_4xxx_phy_dump,
 +     .configure_range        =       ti_hdmi_4xxx_configure_range,

  };

 diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
 index 4bb7678..ae7918e 100644
 --- a/drivers/video/omap2/dss/hdmi.c
 +++ b/drivers/video/omap2/dss/hdmi.c
 @@ -378,6 +378,34 @@ static void hdmi_power_off(struct omap_dss_device 
 *dssdev)
       hdmi_runtime_put();
  }

 +int omapdss_hdmi_set_range(int range)

 Range is an enum, not an int.

 +{
 +     int r = 0;
 +     enum hdmi_range old_range;
 +
 +     old_range = hdmi.ip_data.range;
 +     hdmi.ip_data.range = range;
 +
 +     /* HDMI 1.3 section 6.6 VGA (640x480) format requires Full Range */
 +     if ((range == 0) 

 Range is an enum, not an int.

 +             ((hdmi.ip_data.cfg.cm.code == 4 
 +             hdmi.ip_data.cfg.cm.mode == HDMI_DVI) ||
 +             (hdmi.ip_data.cfg.cm.code == 1 
 +             hdmi.ip_data.cfg.cm.mode == HDMI_HDMI)))
 +                     return -EINVAL;
 +
 +     r = hdmi.ip_data.ops-configure_range(hdmi.ip_data);
 +     if (r)
 +             hdmi.ip_data.range = old_range;
 +
 +     return r;
 +}
 +
 +int omapdss_hdmi_get_range(void)

 Range is an enum, not an int... I won't comment on any more of these
 cases, please check all uses of range.

 +{
 +     return hdmi.ip_data.range;
 +}
 +
  int omapdss_hdmi_display_check_timing(struct omap_dss_device *dssdev,
                                       struct omap_video_timings *timings)
  {
 diff --git a/drivers/video/omap2/dss/hdmi_panel.c 
 b/drivers/video/omap2/dss/hdmi_panel.c
 index 533d5dc..c0aa922 100644
 --- a/drivers/video/omap2/dss/hdmi_panel.c
 +++ b/drivers/video/omap2/dss/hdmi_panel.c
 @@ -33,6 +33,33 @@ static struct {
       struct mutex hdmi_lock;
  } hdmi;

 +static ssize_t hdmi_range_show(struct device *dev,
 +     struct device_attribute *attr, char *buf)
 +{
 +     int r;
 +
 +     r = omapdss_hdmi_get_range();
 +     return snprintf(buf, PAGE_SIZE, %d\n, r);
 +}
 +
 +static ssize_t hdmi_range_store(struct device *dev,
 +     struct device_attribute *attr,
 +     const char *buf, size_t size)
 +{
 +     unsigned long range;
 +     int r = kstrtoul(buf, 0, range);
 +
 +     if (r || range  1)
 +             return -EINVAL;
 +
 +     r = omapdss_hdmi_set_range(range);
 +     if (r)
 +             return r;
 +
 +     return size;
 +}

 I don't like to add a new custom userspace API, but I guess we don't
 have much choice.

 However, I don't think using 0 and 1 in the API is very good. The
 choices with range should probably be full and limited.

 Btw, I tried to apply this patch set on top of dss master with and
 without the improve the timings... patch set, and failed both. What
 are these patches based on?

changes incorporated.
Thanks and regards,
Mythri.
  Tomi

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[BUG] perf_event: no PMU interrupt on OMAP4 with 3.2.0 (Pandaboard)

2012-01-06 Thread Stephane Eranian
Hi,

I am trying to get perf_event to work properly on my OMAP4 Pandabaord
running the 3.2.0 kernel. I am the developer on libpfm4 and a regular
contributor to the perf_event subsystem and perf tool. I want to use
a Pandaboard to test libpfm4 ARM support.

I have been talking with Will Deacon and he suggested I post to this list.

I know that the off-the-shelf 3.2.0 does not have working PMU interrupts.
I have integrated additional patches from both Ming Lei and Linaro. It
seems some parts of those patches were integrated into 3.2.0.

I have attached my 3.2.0 changes to this message. With that, I get perf_event
to register PMU interrupts 33 and 34. However, they don't fire when I count
therefore the counts are bogus (counters wrap around).

I suspect I am missing something in the patch I put together. But I don't know
what's missing. I am not an ARM platform expert. I am hoping someone on this
list may shed some light on this problem.

It would be really nice to have perf_event running out of the box on Pandaboard
for 3.3. It would go a long way into making performance monitoring usable on 
ARM.

Thanks.
---

diff --git a/arch/arm/include/asm/pmu.h b/arch/arm/include/asm/pmu.h
index 0bda22c..b5a5be2 100644
--- a/arch/arm/include/asm/pmu.h
+++ b/arch/arm/include/asm/pmu.h
@@ -27,13 +27,22 @@ enum arm_pmu_type {
 /*
  * struct arm_pmu_platdata - ARM PMU platform data
  *
- * @handle_irq: an optional handler which will be called from the interrupt and
- * passed the address of the low level handler, and can be used to implement
- * any platform specific handling before or after calling it.
+ * @handle_irq: an optional handler which will be called from the
+ * interrupt and passed the address of the low level handler,
+ * and can be used to implement any platform specific handling
+ * before or after calling it.
+ * @enable_irq: an optional handler which will be called after
+ * request_irq and be used to handle some platform specific
+ * irq enablement
+ * @disable_irq: an optional handler which will be called before
+ * free_irq and be used to handle some platform specific
+ * irq disablement
  */
 struct arm_pmu_platdata {
irqreturn_t (*handle_irq)(int irq, void *dev,
  irq_handler_t pmu_handler);
+   void (*enable_irq)(int irq);
+   void (*disable_irq)(int irq);
 };
 
 #ifdef CONFIG_CPU_HAS_PMU
diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c
index 88b0941..24e001f 100644
--- a/arch/arm/kernel/perf_event.c
+++ b/arch/arm/kernel/perf_event.c
@@ -380,6 +380,8 @@ armpmu_release_hardware(struct arm_pmu *armpmu)
 {
int i, irq, irqs;
struct platform_device *pmu_device = armpmu-plat_device;
+   struct arm_pmu_platdata *plat =
+   dev_get_platdata(pmu_device-dev);
 
irqs = min(pmu_device-num_resources, num_possible_cpus());
 
@@ -387,8 +389,11 @@ armpmu_release_hardware(struct arm_pmu *armpmu)
if (!cpumask_test_and_clear_cpu(i, armpmu-active_irqs))
continue;
irq = platform_get_irq(pmu_device, i);
-   if (irq = 0)
+   if (irq = 0) {
+   if (plat-disable_irq)
+   plat-disable_irq(irq);
free_irq(irq, armpmu);
+   }
}
 
release_pmu(armpmu-type);
@@ -449,6 +454,8 @@ armpmu_reserve_hardware(struct arm_pmu *armpmu)
armpmu_release_hardware(armpmu);
return err;
}
+   if (plat-enable_irq)
+   plat-enable_irq(irq);
 
cpumask_set_cpu(i, armpmu-active_irqs);
}
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index c15cfad..6caf31a 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -17,12 +17,14 @@
 #include linux/err.h
 #include linux/slab.h
 #include linux/of.h
+#include linux/pm_runtime.h
 
 #include mach/hardware.h
 #include mach/irqs.h
 #include asm/mach-types.h
 #include asm/mach/map.h
 #include asm/pmu.h
+#include asm/cti.h
 
 #include plat/tc.h
 #include plat/board.h
@@ -404,14 +406,136 @@ static struct platform_device omap_pmu_device = {
.num_resources  = 1,
 };
 
-static void omap_init_pmu(void)
+static struct arm_pmu_platdata omap4_pmu_data;
+static struct cti omap4_cti[2];
+static struct platform_device *pmu_dev;
+
+static void omap4_enable_cti(int irq)
 {
-   if (cpu_is_omap24xx())
+   pm_runtime_get_sync(pmu_dev-dev);
+
+   if (irq == OMAP44XX_IRQ_CTI0)
+   cti_enable(omap4_cti[0]);
+   else if (irq == OMAP44XX_IRQ_CTI1)
+   cti_enable(omap4_cti[1]);
+}
+
+static void omap4_disable_cti(int irq)
+{
+   if (irq == OMAP44XX_IRQ_CTI0)
+   cti_disable(omap4_cti[0]);
+   else if (irq == OMAP44XX_IRQ_CTI1)
+   cti_disable(omap4_cti[1]);
+   

Re: [PATCH] OMAP: I2C: add devexit to the remove code

2012-01-06 Thread Ben Dooks
On Tue, Dec 20, 2011 at 12:55:59PM +0530, Shubhrajyoti D wrote:
 The omap_i2c_remove function may not be needed after
 device exit so the memory could be freed.
 
 Signed-off-by: Shubhrajyoti D shubhrajy...@ti.com

Will add this later.

 ---
  drivers/i2c/busses/i2c-omap.c |5 ++---
  1 files changed, 2 insertions(+), 3 deletions(-)
 
 diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
 index fa23faa..2efdc6b 100644
 --- a/drivers/i2c/busses/i2c-omap.c
 +++ b/drivers/i2c/busses/i2c-omap.c
 @@ -,8 +,7 @@ err_release_region:
   return r;
  }
  
 -static int
 -omap_i2c_remove(struct platform_device *pdev)
 +static int __devexit omap_i2c_remove(struct platform_device *pdev)
  {
   struct omap_i2c_dev *dev = platform_get_drvdata(pdev);
   struct resource *mem;
 @@ -1161,7 +1160,7 @@ static struct dev_pm_ops omap_i2c_pm_ops = {
  
  static struct platform_driver omap_i2c_driver = {
   .probe  = omap_i2c_probe,
 - .remove = omap_i2c_remove,
 + .remove = __devexit_p(omap_i2c_remove),
   .driver = {
   .name   = omap_i2c,
   .owner  = THIS_MODULE,
 -- 
 1.7.1
 
 --
 To unsubscribe from this list: send the line unsubscribe linux-i2c in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Ben Dooks, b...@fluff.org, http://www.fluff.org/ben/

Large Hadron Colada: A large Pina Colada that makes the universe disappear.

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/3] ARM: OMAP2+: kconfig: Enable devicetree by default for OMAP2+ systems

2012-01-06 Thread Cousson, Benoit

On 1/4/2012 9:11 PM, Grant Likely wrote:

On Tue, Dec 6, 2011 at 9:49 AM, Benoit Coussonb-cous...@ti.com  wrote:

devicetree will become the mandatory boot method for OMAP2+.
In order to avoid cluttering the OMAP code with #ifdef CONFIG_OF,
select USE_OF by default for every OMAP2+ systems.
Select as well the APPENDED_DTB and ATAG_DTB_COMPAT to allow legacy
boot loader to keep working properly.

Enable PROC_DEVICETREE as well.

Signed-off-by: Benoit Coussonb-cous...@ti.com
Cc: Tony Lindgrent...@atomide.com


Acked-by: Grant Likelygrant.lik...@secretlab.ca


Thanks for the reviews.

Benoit

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GIT PULL] I2C: OMAP: misc. updates for v3.3

2012-01-06 Thread Ben Dooks
On Thu, Jan 05, 2012 at 04:13:51PM -0800, Kevin Hilman wrote:
 Hi Ben,
 
 Here's a few OMAP I2C updates for the v3.3 merge window.

ok, added these to my i2c-next and for-33/i2c/omap.
 
 Thanks,
 
 Kevin
 
 The following changes since commit 3f6b2a8bd6e4ff43269d89066a9fe06a0e5ba961:
 
   I2C: OMAP: correct SYSC register offset for OMAP4 (2011-12-13 11:35:56 
 -0800)
 
 are available in the git repository at:
   git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-omap-pm.git 
 for_3.3/i2c/misc
 
 Benoit Cousson (1):
   i2c: OMAP: Add DT support for i2c controller
 
 Jan Weitzel (1):
   I2C: OMAP: NACK without STP
 
  Documentation/devicetree/bindings/i2c/omap-i2c.txt |   30 ++
  drivers/i2c/busses/i2c-omap.c  |  108 
 +---
  2 files changed, 99 insertions(+), 39 deletions(-)
  create mode 100644 Documentation/devicetree/bindings/i2c/omap-i2c.txt
 --
 To unsubscribe from this list: send the line unsubscribe linux-i2c in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Ben Dooks, b...@fluff.org, http://www.fluff.org/ben/

Large Hadron Colada: A large Pina Colada that makes the universe disappear.

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 0/5] ARM: OMAP2+: Interrupt controllers adaptation to DT

2012-01-06 Thread Cousson, Benoit

Hi Rob/Grant,

Gentle ping on that series too. This should the last one:-)

Thanks,
Benoit

On 12/23/2011 10:46 AM, Cousson, Benoit wrote:

Hi Rob,

Are you OK with that update?

Thanks,
Benoit

On 12/20/2011 2:39 PM, Benoit Cousson wrote:

Hi Tony and Rob,

Here is the series to take advantage of the new DT interrupt init
mechanism.
Thanks to Marc's CONFIG_MULTI_IRQ_HANDLER series, OMAP4 just has to
use the
default GIC binding and does not need some OMAP specific hacks anymore.
OMAP2 and 3 are using a simple interrupt controller that can thus expose
a simpler binding.

This update, compared to v1 [1], is introducing the IRQ domain for the
OMAP23 INTC by default for both DT and none-DT build.
Please note that in the near future that code can even be simplier
with the
introduction of the domain support inside generic irq chip.

This series is based on lo/dt branch to get the needed cleanup and
fixes for
OMAP.

The series is available here for reference:
git://gitorious.org/omap-pm/linux.git for_3.3/2_dt_irq

Regards,
Benoit

[1] http://www.spinics.net/lists/linux-omap/msg61152.html


Benoit Cousson (5):
arm/dts: OMAP4: Update DTS file with new GIC bindings
ARM: OMAP2/3: intc: Add irqdomain support
ARM: OMAP2/3: intc: Add DT support for TI interrupt controller
arm/dts: OMAP3: Add interrupt-controller bindings for INTC
ARM: OMAP2+: board-generic: Use of_irq_init API

.../devicetree/bindings/arm/omap/intc.txt | 27 +++
arch/arm/boot/dts/omap3.dtsi | 6 ++-
arch/arm/boot/dts/omap4.dtsi | 3 +-
arch/arm/mach-omap2/board-generic.c | 30 +++--
arch/arm/mach-omap2/common.h | 10 
arch/arm/mach-omap2/irq.c | 48 ++--
6 files changed, 103 insertions(+), 21 deletions(-)
create mode 100644 Documentation/devicetree/bindings/arm/omap/intc.txt





--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] irqdomain: Initialize number of IRQs for simple domains

2012-01-06 Thread Cousson, Benoit

Hi Thierry,

On 1/6/2012 3:28 PM, Thierry Reding wrote:

The irq_domain_add() function needs the number of interrupts in the
domain to properly initialize them. In addition the allocated domain
is now returned by the irq_domain_{add,generate}_simple() helpers.


[...]


diff --git a/arch/arm/mach-omap2/board-generic.c 
b/arch/arm/mach-omap2/board-generic.c
index d587560..bf67781 100644
--- a/arch/arm/mach-omap2/board-generic.c
+++ b/arch/arm/mach-omap2/board-generic.c
@@ -66,8 +66,11 @@ static struct of_device_id intc_match[] __initdata = {
  static void __init omap_generic_init(void)
  {
struct device_node *node = of_find_matching_node(NULL, intc_match);
-   if (node)
-   irq_domain_add_simple(node, 0);
+   if (node) {
+   struct irq_domain *domain;
+   domain = irq_domain_add_simple(node, 0, INTCPS_NR_IRQS);


The number of interrupts will depend on the OMAP generation. That one is 
just valid for the 3430 INTC controller.
Since the previous code was using zero, I guess that using 0 there 
should be fine.


Moreover, that piece of code should not exist anymore on 3.3 if the 
series I sent last month to leverage Rob's DT interrupt init is merged [1].


I've just ping Rob and Grant on that series to get a status.

Regards,
Benoit


[1] http://www.spinics.net/lists/linux-omap/msg62124.html
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC/PATCH 8/7] ARM: OMAP: AM35xx: convert 3517 detection/flags to AM35xx

2012-01-06 Thread Kevin Hilman
Currently cpu_is_omap3517() actually detects any device in the AM35x
family (3517 and no-SGX version 3505.)  To make it more clear what is
being detected, convert the names from 3517 to AM35xx.

For the same reason, replace the CK_3517 flag used in the clock data
to CK_AM35XX.

Signed-off-by: Kevin Hilman khil...@ti.com
---
 arch/arm/mach-omap2/clock3xxx_data.c  |8 
 arch/arm/mach-omap2/hsmmc.c   |8 
 arch/arm/mach-omap2/id.c  |7 +++
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c|2 +-
 arch/arm/mach-omap2/powerdomains3xxx_data.c   |2 +-
 arch/arm/mach-omap2/usb-musb.c|2 +-
 arch/arm/mach-omap2/voltagedomains3xxx_data.c |2 +-
 arch/arm/plat-omap/include/plat/clkdev_omap.h |3 +--
 arch/arm/plat-omap/include/plat/cpu.h |   15 +++
 9 files changed, 23 insertions(+), 26 deletions(-)

diff --git a/arch/arm/mach-omap2/clock3xxx_data.c 
b/arch/arm/mach-omap2/clock3xxx_data.c
index 26fb4d9..745df5f 100644
--- a/arch/arm/mach-omap2/clock3xxx_data.c
+++ b/arch/arm/mach-omap2/clock3xxx_data.c
@@ -3286,8 +3286,8 @@ static struct omap_clk omap3xxx_clks[] = {
CLK(NULL,   gfx_l3_ick,   gfx_l3_ick,CK_3430ES1),
CLK(NULL,   gfx_cg1_ck,   gfx_cg1_ck,CK_3430ES1),
CLK(NULL,   gfx_cg2_ck,   gfx_cg2_ck,CK_3430ES1),
-   CLK(NULL,   sgx_fck,  sgx_fck,   CK_3430ES2PLUS | 
CK_3517 | CK_36XX),
-   CLK(NULL,   sgx_ick,  sgx_ick,   CK_3430ES2PLUS | 
CK_3517 | CK_36XX),
+   CLK(NULL,   sgx_fck,  sgx_fck,   CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
+   CLK(NULL,   sgx_ick,  sgx_ick,   CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
CLK(NULL,   d2d_26m_fck,  d2d_26m_fck,   CK_3430ES1),
CLK(NULL,   modem_fck,modem_fck, CK_34XX | CK_36XX),
CLK(NULL,   sad2d_ick,sad2d_ick, CK_34XX | CK_36XX),
@@ -3505,9 +3505,9 @@ int __init omap3xxx_clk_init(void)
struct omap_clk *c;
u32 cpu_clkflg = 0;
 
-   if (cpu_is_omap3517()) {
+   if (cpu_is_am35xx()) {
cpu_mask = RATE_IN_34XX;
-   cpu_clkflg = CK_3517;
+   cpu_clkflg = CK_AM35XX;
} else if (cpu_is_omap3630()) {
cpu_mask = (RATE_IN_34XX | RATE_IN_36XX);
cpu_clkflg = CK_36XX;
diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c
index c49a91d..70dbe6a 100644
--- a/arch/arm/mach-omap2/hsmmc.c
+++ b/arch/arm/mach-omap2/hsmmc.c
@@ -353,7 +353,7 @@ static int __init omap_hsmmc_pdata_init(struct 
omap2_hsmmc_info *c,
 *
 * temporary HACK: ocr_mask instead of fixed supply
 */
-   if (cpu_is_omap3517())
+   if (cpu_is_am35xx())
mmc-slots[0].ocr_mask = MMC_VDD_165_195 |
 MMC_VDD_26_27 |
 MMC_VDD_27_28 |
@@ -363,7 +363,7 @@ static int __init omap_hsmmc_pdata_init(struct 
omap2_hsmmc_info *c,
else
mmc-slots[0].ocr_mask = c-ocr_mask;
 
-   if (!cpu_is_omap3517())
+   if (!cpu_is_am35xx())
mmc-slots[0].features |= HSMMC_HAS_PBIAS;
 
if (cpu_is_omap44xx()  (omap_rev()  OMAP4430_REV_ES1_0))
@@ -386,7 +386,7 @@ static int __init omap_hsmmc_pdata_init(struct 
omap2_hsmmc_info *c,
}
}
 
-   if (cpu_is_omap3517())
+   if (cpu_is_am35xx())
mmc-slots[0].set_power = nop_mmc_set_power;
 
/* OMAP3630 HSMMC1 supports only 4-bit */
@@ -398,7 +398,7 @@ static int __init omap_hsmmc_pdata_init(struct 
omap2_hsmmc_info *c,
}
break;
case 2:
-   if (cpu_is_omap3517())
+   if (cpu_is_am35xx())
mmc-slots[0].set_power = am35x_hsmmc2_set_power;
 
if (c-ext_clock)
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index 92e4d55..325e12e 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -183,8 +183,7 @@ static void __init omap3_cpuinfo(void)
 */
if (cpu_is_omap3630()) {
cpu_name = OMAP3630;
-   } else if (cpu_is_omap3517()) {
-   /* AM35xx devices */
+   } else if (cpu_is_am35xx()) {
cpu_name = (omap3_has_sgx()) ? AM3517 : AM3505;
} else if (cpu_is_ti816x()) {
cpu_name = TI816X;
@@ -350,13 +349,13 @@ void __init omap3xxx_check_revision(void)
 */
switch (rev) {
case 0:
-   omap_revision = OMAP3517_REV_ES1_0;
+   omap_revision = AM35XX_REV_ES1_0;
cpu_rev = 1.0;
break;
case 1:
/* FALLTHROUGH */
default:
-   omap_revision = 

Re: [PATCH 0/7] ARM: OMAP: remove IP checks from SoC family detection

2012-01-06 Thread Kevin Hilman
Hiremath, Vaibhav hvaib...@ti.com writes:

 Currently, our SoC detection is based on SoC family detection
 (using die ID) and the presence of specific IP blocks (or feature.)
 
 This series begins the separation of the SoC family detection and
 specific IP detection.
 
 Applies on top of Tony's current master branch and so far, it has only
 been compile tested using omap2plus_defconfig.
 
 I tested it on OMAP3EVM (AM37x) and AM3517EVM as well and it is booting up
 for me.

 Feel free to add my acked and/or tested by.

Great, thanks for testing!

Can you also test with the patch 8 that I just sent?   It boot tests
fine on my AM3517 EVM, but didn't do any other tests.

Thanks,

Kevin

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 0/5] ARM: OMAP2+: Interrupt controllers adaptation to DT

2012-01-06 Thread Rob Herring
On 01/06/2012 10:38 AM, Cousson, Benoit wrote:
 Hi Rob/Grant,
 
 Gentle ping on that series too. This should the last one:-)
 
Sorry about that. For the series:

Acked-by: Rob Herring rob.herr...@calxeda.com

Rob

 Thanks,
 Benoit
 
 On 12/23/2011 10:46 AM, Cousson, Benoit wrote:
 Hi Rob,

 Are you OK with that update?

 Thanks,
 Benoit

 On 12/20/2011 2:39 PM, Benoit Cousson wrote:
 Hi Tony and Rob,

 Here is the series to take advantage of the new DT interrupt init
 mechanism.
 Thanks to Marc's CONFIG_MULTI_IRQ_HANDLER series, OMAP4 just has to
 use the
 default GIC binding and does not need some OMAP specific hacks anymore.
 OMAP2 and 3 are using a simple interrupt controller that can thus expose
 a simpler binding.

 This update, compared to v1 [1], is introducing the IRQ domain for the
 OMAP23 INTC by default for both DT and none-DT build.
 Please note that in the near future that code can even be simplier
 with the
 introduction of the domain support inside generic irq chip.

 This series is based on lo/dt branch to get the needed cleanup and
 fixes for
 OMAP.

 The series is available here for reference:
 git://gitorious.org/omap-pm/linux.git for_3.3/2_dt_irq

 Regards,
 Benoit

 [1] http://www.spinics.net/lists/linux-omap/msg61152.html


 Benoit Cousson (5):
 arm/dts: OMAP4: Update DTS file with new GIC bindings
 ARM: OMAP2/3: intc: Add irqdomain support
 ARM: OMAP2/3: intc: Add DT support for TI interrupt controller
 arm/dts: OMAP3: Add interrupt-controller bindings for INTC
 ARM: OMAP2+: board-generic: Use of_irq_init API

 .../devicetree/bindings/arm/omap/intc.txt | 27 +++
 arch/arm/boot/dts/omap3.dtsi | 6 ++-
 arch/arm/boot/dts/omap4.dtsi | 3 +-
 arch/arm/mach-omap2/board-generic.c | 30 +++--
 arch/arm/mach-omap2/common.h | 10 
 arch/arm/mach-omap2/irq.c | 48 ++--
 6 files changed, 103 insertions(+), 21 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/arm/omap/intc.txt


 
 ___
 devicetree-discuss mailing list
 devicetree-disc...@lists.ozlabs.org
 https://lists.ozlabs.org/listinfo/devicetree-discuss

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 1/5] arm/dts: OMAP4: Update DTS file with new GIC bindings

2012-01-06 Thread Grant Likely
On Tue, Dec 20, 2011 at 02:39:54PM +0100, Benoit Cousson wrote:
 The GIC binding was updated in 3.2 and expect 3 interrupt-cells.
 - Update the #interrupt-cells
 - interrupt-parent seems to be needed as well for the top level GIC

Hmmm... it shouldn't be.  If it is then it is a bug.

g.

 
 Signed-off-by: Benoit Cousson b-cous...@ti.com
 Cc: Rob Herring rob.herr...@calxeda.com
 ---
  arch/arm/boot/dts/omap4.dtsi |3 ++-
  1 files changed, 2 insertions(+), 1 deletions(-)
 
 diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
 index 4c61c82..bede009 100644
 --- a/arch/arm/boot/dts/omap4.dtsi
 +++ b/arch/arm/boot/dts/omap4.dtsi
 @@ -95,7 +95,8 @@
   gic: interrupt-controller@48241000 {
   compatible = arm,cortex-a9-gic;
   interrupt-controller;
 - #interrupt-cells = 1;
 + interrupt-parent;
 + #interrupt-cells = 3;
   reg = 0x48241000 0x1000,
 0x48240100 0x0100;
   };
 -- 
 1.7.0.4
 
 
 ___
 linux-arm-kernel mailing list
 linux-arm-ker...@lists.infradead.org
 http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 2/5] ARM: OMAP2/3: intc: Add irqdomain support

2012-01-06 Thread Grant Likely
On Tue, Dec 20, 2011 at 02:39:55PM +0100, Benoit Cousson wrote:
 Introduce the usage of the irqdomain to prepare the DT support.
 The irq_base is still hard coded to 0 to allow non-DT drivers
 to work with the previous assumption that was hwirq = irq.
 
 Signed-off-by: Benoit Cousson b-cous...@ti.com
 Cc: Tony Lindgren t...@atomide.com
 Cc: Rob Herring rob.herr...@calxeda.com
 ---
  arch/arm/mach-omap2/irq.c |   18 +-
  1 files changed, 17 insertions(+), 1 deletions(-)
 
 diff --git a/arch/arm/mach-omap2/irq.c b/arch/arm/mach-omap2/irq.c
 index 42b1d65..2f65dfd 100644
 --- a/arch/arm/mach-omap2/irq.c
 +++ b/arch/arm/mach-omap2/irq.c
 @@ -17,6 +17,7 @@
  #include mach/hardware.h
  #include asm/exception.h
  #include asm/mach/irq.h
 +#include linux/irqdomain.h
  
  
  /* selected INTC register offsets */
 @@ -57,6 +58,8 @@ static struct omap_irq_bank {
   },
  };
  
 +static struct irq_domain domain;
 +
  /* Structure to save interrupt controller context */
  struct omap3_intc_regs {
   u32 sysconfig;
 @@ -158,6 +161,17 @@ static void __init omap_init_irq(u32 base, int nr_irqs)
   if (WARN_ON(!omap_irq_base))
   return;
  
 + /*
 +  * XXX: Use a 0 irq_base for the moment since the legacy devices
 +  * created statically are expected a hwirq = irq mapping.
 +  * A proper offset will be added later, when IRQ resource creation
 +  * will be handled by DT.
 +  */
 + domain.irq_base = 0;
 + domain.nr_irq = nr_irqs;
 + domain.ops = irq_domain_simple_ops;
 + irq_domain_add(domain);

The omap doesn't need anything special from irq_domain.  You can use
irq_domain_add_simple().  A recent patch was posted that makes
irq_domain_add_simple() accepts a nr_irqs parameter and returns the
allocated irq domain.

However, that isn't enough reason for me to reject this patch if there
is any opportunity to get it into v3.3 provided you promise to fix it
up later.

Acked-by: Grant Likely grant.lik...@secretlab.ca

 +
   for (i = 0; i  ARRAY_SIZE(irq_banks); i++) {
   struct omap_irq_bank *bank = irq_banks + i;
  
 @@ -225,8 +239,10 @@ out:
   irqnr = readl_relaxed(base_addr + INTCPS_SIR_IRQ_OFFSET);
   irqnr = ACTIVEIRQ_MASK;
  
 - if (irqnr)
 + if (irqnr) {
 + irqnr = irq_domain_to_irq(domain, irqnr);
   handle_IRQ(irqnr, regs);
 + }
   } while (irqnr);
  }
  
 -- 
 1.7.0.4
 
 
 ___
 linux-arm-kernel mailing list
 linux-arm-ker...@lists.infradead.org
 http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 3/5] ARM: OMAP2/3: intc: Add DT support for TI interrupt controller

2012-01-06 Thread Grant Likely
On Tue, Dec 20, 2011 at 02:39:56PM +0100, Benoit Cousson wrote:
 Add a function to initialize the OMAP2/3 interrupt controller (INTC)
 using a device tree node.
 
 Replace some printk() with the proper pr_ macro.
 
 Signed-off-by: Benoit Cousson b-cous...@ti.com
 Cc: Tony Lindgren t...@atomide.com
 Cc: Rob Herring rob.herr...@calxeda.com

Acked-by: Grant Likely grant.lik...@secretlab.ca

 ---
  .../devicetree/bindings/arm/omap/intc.txt  |   27 ++
  arch/arm/mach-omap2/common.h   |   10 ++
  arch/arm/mach-omap2/irq.c  |   30 
 ++--
  3 files changed, 64 insertions(+), 3 deletions(-)
  create mode 100644 Documentation/devicetree/bindings/arm/omap/intc.txt
 
 diff --git a/Documentation/devicetree/bindings/arm/omap/intc.txt 
 b/Documentation/devicetree/bindings/arm/omap/intc.txt
 new file mode 100644
 index 000..f2583e6
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/arm/omap/intc.txt
 @@ -0,0 +1,27 @@
 +* OMAP Interrupt Controller
 +
 +OMAP2/3 are using a TI interrupt controller that can support several
 +configurable number of interrupts.
 +
 +Main node required properties:
 +
 +- compatible : should be:
 + ti,omap2-intc
 +- interrupt-controller : Identifies the node as an interrupt controller
 +- #interrupt-cells : Specifies the number of cells needed to encode an
 +  interrupt source. The type shall be a u32 and the value shall be 1.
 +
 +  The cell contains the interrupt number in the range [0-128].
 +- ti,intc-size: Number of interrupts handled by the interrupt controller.
 +- reg: physical base address and size of the intc registers map.
 +
 +Example:
 +
 + intc: interrupt-controller@1 {
 + compatible = ti,omap2-intc;
 + interrupt-controller;
 + #interrupt-cells = 1;
 + ti,intc-size = 96;
 + reg = 0x4820 0x1000;
 + };
 +
 diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h
 index 012bac7..bcfccc2 100644
 --- a/arch/arm/mach-omap2/common.h
 +++ b/arch/arm/mach-omap2/common.h
 @@ -156,6 +156,16 @@ void omap3_intc_resume_idle(void);
  void omap2_intc_handle_irq(struct pt_regs *regs);
  void omap3_intc_handle_irq(struct pt_regs *regs);
  
 +struct device_node;
 +#ifdef CONFIG_OF
 +int __init intc_of_init(struct device_node *node, struct device_node 
 *parent);
 +#else
 +int __init intc_of_init(struct device_node *node, struct device_node *parent)
 +{
 + return 0;
 +}
 +#endif
 +
  /*
   * wfi used in low power code. Directly opcode is used instead
   * of instruction to avoid mulit-omap build break
 diff --git a/arch/arm/mach-omap2/irq.c b/arch/arm/mach-omap2/irq.c
 index 2f65dfd..f3722b1 100644
 --- a/arch/arm/mach-omap2/irq.c
 +++ b/arch/arm/mach-omap2/irq.c
 @@ -18,6 +18,8 @@
  #include asm/exception.h
  #include asm/mach/irq.h
  #include linux/irqdomain.h
 +#include linux/of.h
 +#include linux/of_address.h
  
  
  /* selected INTC register offsets */
 @@ -180,7 +182,7 @@ static void __init omap_init_irq(u32 base, int nr_irqs)
   /* Static mapping, never released */
   bank-base_reg = ioremap(base, SZ_4K);
   if (!bank-base_reg) {
 - printk(KERN_ERR Could not ioremap irq bank%i\n, i);
 + pr_err(Could not ioremap irq bank%i\n, i);
   continue;
   }
  
 @@ -193,8 +195,8 @@ static void __init omap_init_irq(u32 base, int nr_irqs)
   nr_banks++;
   }
  
 - printk(KERN_INFO Total of %ld interrupts on %d active controller%s\n,
 -nr_of_irqs, nr_banks, nr_banks  1 ? s : );
 + pr_info(Total of %ld interrupts on %d active controller%s\n,
 + nr_of_irqs, nr_banks, nr_banks  1 ? s : );
  }
  
  void __init omap2_init_irq(void)
 @@ -252,6 +254,28 @@ asmlinkage void __exception_irq_entry 
 omap2_intc_handle_irq(struct pt_regs *regs
   omap_intc_handle_irq(base_addr, regs);
  }
  
 +int __init intc_of_init(struct device_node *node, struct device_node *parent)
 +{
 + struct resource res;
 + u32 nr_irqs = 96;
 +
 + if (WARN_ON(!node))
 + return -ENODEV;
 +
 + if (of_address_to_resource(node, 0, res)) {
 + WARN(1, unable to get intc registers\n);
 + return -EINVAL;
 + }
 +
 + if (of_property_read_u32(node, ti,intc-size, nr_irqs))
 + pr_warn(unable to get intc-size, default to %d\n, nr_irqs);
 +
 + omap_init_irq(res.start, nr_irqs);
 + domain.of_node = of_node_get(node);
 +
 + return 0;
 +}
 +
  #ifdef CONFIG_ARCH_OMAP3
  static struct omap3_intc_regs intc_context[ARRAY_SIZE(irq_banks)];
  
 -- 
 1.7.0.4
 
 
 ___
 linux-arm-kernel mailing list
 linux-arm-ker...@lists.infradead.org
 http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to 

Re: [PATCH v2 4/5] arm/dts: OMAP3: Add interrupt-controller bindings for INTC

2012-01-06 Thread Grant Likely
On Tue, Dec 20, 2011 at 02:39:57PM +0100, Benoit Cousson wrote:
 Update the DTS with the proper information required by the
 INTC bindings.
 
 - Add the number of interrupt lines
 - Add the reg and the compatible entries.
 
 Signed-off-by: Benoit Cousson b-cous...@ti.com
 Cc: Rob Herring rob.herr...@calxeda.com

Acked-by: Grant Likely grant.lik...@secretlab.ca

 ---
  arch/arm/boot/dts/omap3.dtsi |6 --
  1 files changed, 4 insertions(+), 2 deletions(-)
 
 diff --git a/arch/arm/boot/dts/omap3.dtsi b/arch/arm/boot/dts/omap3.dtsi
 index d202bb5..6866dc7 100644
 --- a/arch/arm/boot/dts/omap3.dtsi
 +++ b/arch/arm/boot/dts/omap3.dtsi
 @@ -54,10 +54,12 @@
   ranges;
   ti,hwmods = l3_main;
  
 - intc: interrupt-controller@1 {
 - compatible = ti,omap3-intc;
 + intc: interrupt-controller@4820 {
 + compatible = ti,omap2-intc;
   interrupt-controller;
   #interrupt-cells = 1;
 + ti,intc-size = 96;
 + reg = 0x4820 0x1000;
   };
   };
  };
 -- 
 1.7.0.4
 
 
 ___
 linux-arm-kernel mailing list
 linux-arm-ker...@lists.infradead.org
 http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 5/5] ARM: OMAP2+: board-generic: Use of_irq_init API

2012-01-06 Thread Grant Likely
On Tue, Dec 20, 2011 at 02:39:58PM +0100, Benoit Cousson wrote:
 Use the of_irq_init API introduced in 3.2 to handle
 interrupt-controller with DT.
 Update the irq_match table to map the proper XXX_of_init
 functions for INTC and GIC drivers.
 
 Signed-off-by: Benoit Cousson b-cous...@ti.com
 Cc: Tony Lindgren t...@atomide.com
 Cc: Rob Herring rob.herr...@calxeda.com

Acked-by: Grant Likely grant.lik...@secretlab.ca

 ---
  arch/arm/mach-omap2/board-generic.c |   30 --
  1 files changed, 16 insertions(+), 14 deletions(-)
 
 diff --git a/arch/arm/mach-omap2/board-generic.c 
 b/arch/arm/mach-omap2/board-generic.c
 index e493877..2529017 100644
 --- a/arch/arm/mach-omap2/board-generic.c
 +++ b/arch/arm/mach-omap2/board-generic.c
 @@ -12,6 +12,7 @@
   * published by the Free Software Foundation.
   */
  #include linux/io.h
 +#include linux/of_irq.h
  #include linux/of_platform.h
  #include linux/irqdomain.h
  #include linux/i2c/twl.h
 @@ -24,6 +25,17 @@
  #include common.h
  #include common-board-devices.h
  
 +static struct of_device_id irq_match[] __initdata = {
 + { .compatible = ti,omap2-intc, .data = intc_of_init, },
 + { .compatible = arm,cortex-a9-gic, .data = gic_of_init, },
 + { }
 +};
 +
 +static void __init omap_init_irq(void)
 +{
 + of_irq_init(irq_match);
 +}
 +
  /*
   * XXX: Still needed to boot until the i2c  twl driver is adapted to
   * device-tree
 @@ -58,18 +70,8 @@ static struct of_device_id omap_dt_match_table[] 
 __initdata = {
   { }
  };
  
 -static struct of_device_id intc_match[] __initdata = {
 - { .compatible = ti,omap3-intc, },
 - { .compatible = arm,cortex-a9-gic, },
 - { }
 -};
 -
  static void __init omap_generic_init(void)
  {
 - struct device_node *node = of_find_matching_node(NULL, intc_match);
 - if (node)
 - irq_domain_add_simple(node, 0);
 -
   omap_serial_init();
   omap_sdrc_init(NULL, NULL);
  
 @@ -103,7 +105,7 @@ DT_MACHINE_START(OMAP242X_DT, Generic OMAP2420 
 (Flattened Device Tree))
   .reserve= omap_reserve,
   .map_io = omap242x_map_io,
   .init_early = omap2420_init_early,
 - .init_irq   = omap2_init_irq,
 + .init_irq   = omap_init_irq,
   .handle_irq = omap2_intc_handle_irq,
   .init_machine   = omap_generic_init,
   .timer  = omap2_timer,
 @@ -122,7 +124,7 @@ DT_MACHINE_START(OMAP243X_DT, Generic OMAP2430 
 (Flattened Device Tree))
   .reserve= omap_reserve,
   .map_io = omap243x_map_io,
   .init_early = omap2430_init_early,
 - .init_irq   = omap2_init_irq,
 + .init_irq   = omap_init_irq,
   .handle_irq = omap2_intc_handle_irq,
   .init_machine   = omap_generic_init,
   .timer  = omap2_timer,
 @@ -141,7 +143,7 @@ DT_MACHINE_START(OMAP3_DT, Generic OMAP3 (Flattened 
 Device Tree))
   .reserve= omap_reserve,
   .map_io = omap3_map_io,
   .init_early = omap3430_init_early,
 - .init_irq   = omap3_init_irq,
 + .init_irq   = omap_init_irq,
   .handle_irq = omap3_intc_handle_irq,
   .init_machine   = omap3_init,
   .timer  = omap3_timer,
 @@ -160,7 +162,7 @@ DT_MACHINE_START(OMAP4_DT, Generic OMAP4 (Flattened 
 Device Tree))
   .reserve= omap_reserve,
   .map_io = omap4_map_io,
   .init_early = omap4430_init_early,
 - .init_irq   = gic_init_irq,
 + .init_irq   = omap_init_irq,
   .handle_irq = gic_handle_irq,
   .init_machine   = omap4_init,
   .timer  = omap4_timer,
 -- 
 1.7.0.4
 
 
 ___
 linux-arm-kernel mailing list
 linux-arm-ker...@lists.infradead.org
 http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 1/5] arm/dts: OMAP4: Update DTS file with new GIC bindings

2012-01-06 Thread Rob Herring
On 01/06/2012 03:15 PM, Grant Likely wrote:
 On Tue, Dec 20, 2011 at 02:39:54PM +0100, Benoit Cousson wrote:
 The GIC binding was updated in 3.2 and expect 3 interrupt-cells.
 - Update the #interrupt-cells
 - interrupt-parent seems to be needed as well for the top level GIC
 
 Hmmm... it shouldn't be.  If it is then it is a bug.
 

I think this is an old comment which I fixed in 3.2, so interrupt-parent
can be removed.

Rob

 g.
 

 Signed-off-by: Benoit Cousson b-cous...@ti.com
 Cc: Rob Herring rob.herr...@calxeda.com
 ---
  arch/arm/boot/dts/omap4.dtsi |3 ++-
  1 files changed, 2 insertions(+), 1 deletions(-)

 diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
 index 4c61c82..bede009 100644
 --- a/arch/arm/boot/dts/omap4.dtsi
 +++ b/arch/arm/boot/dts/omap4.dtsi
 @@ -95,7 +95,8 @@
  gic: interrupt-controller@48241000 {
  compatible = arm,cortex-a9-gic;
  interrupt-controller;
 -#interrupt-cells = 1;
 +interrupt-parent;
 +#interrupt-cells = 3;
  reg = 0x48241000 0x1000,
0x48240100 0x0100;
  };
 -- 
 1.7.0.4


 ___
 linux-arm-kernel mailing list
 linux-arm-ker...@lists.infradead.org
 http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html