[uclinux-dist-devel] [GIT PULL] Blackfin updates for 3.14

2014-01-29 Thread Steven Miao
Hi Linus,

please pull blackfin updates for Linux 3.14, some minor changes and bug fixes.

The following changes since commit d8ec26d7f8287f5788a494f56e8814210f0e64be:

  Linux 3.13 (2014-01-19 18:40:07 -0800)

are available in the git repository at:

  http://git.kernel.org/pub/scm/linux/kernel/git/realmz6/blackfin-linux.git 
tags/blackfin-for-linus

for you to fetch changes up to 58095fdaaf1cee12d8e01aa20f94b976e3137d27:

  From: Eunbong Song  (2014-01-29 15:14:56 +0800)


blackfin updates for Linux 3.14


Aaron Wu (2):
  fix build error for bf527-ezkit_defconfig for old silicon
  Add platfrom device resource for bfin-sport on bf533 stamp

Chen Gang (1):
  arch: blackfin: uapi: be sure of "_UAPI" prefix for all guard macros

Jiang Liu (1):
  06/18] smp, blackfin: kill SMP single function call interrupt

Paul Gortmaker (1):
  blackfin: delete non-required instances of 

Sonic Zhang (2):
  blackfin: bf609: update the anomaly list to Nov 2013
  blackfin: Support L1 SRAM parity checking feature on bf60x

Steven Miao (2):
  From: Paul Walmsley 
  From: Eunbong Song 

 arch/blackfin/configs/BF527-EZKIT_defconfig |1 +
 arch/blackfin/configs/BF538-EZKIT_defconfig |1 -
 arch/blackfin/configs/BF561-ACVILON_defconfig   |1 -
 arch/blackfin/configs/BlackStamp_defconfig  |1 -
 arch/blackfin/configs/CM-BF533_defconfig|1 -
 arch/blackfin/configs/CM-BF548_defconfig|1 -
 arch/blackfin/configs/CM-BF561_defconfig|1 -
 arch/blackfin/configs/DNP5370_defconfig |1 -
 arch/blackfin/configs/H8606_defconfig   |1 -
 arch/blackfin/configs/IP0X_defconfig|1 -
 arch/blackfin/configs/PNAV-10_defconfig |1 -
 arch/blackfin/configs/SRV1_defconfig|1 -
 arch/blackfin/configs/TCM-BF518_defconfig   |1 -
 arch/blackfin/include/asm/def_LPBlackfin.h  |1 +
 arch/blackfin/include/uapi/asm/byteorder.h  |5 +++
 arch/blackfin/include/uapi/asm/cachectl.h   |6 +--
 arch/blackfin/include/uapi/asm/fcntl.h  |6 +--
 arch/blackfin/include/uapi/asm/ioctls.h |6 +--
 arch/blackfin/include/uapi/asm/poll.h   |6 +--
 arch/blackfin/include/uapi/asm/posix_types.h|6 +--
 arch/blackfin/include/uapi/asm/sigcontext.h |6 +--
 arch/blackfin/include/uapi/asm/siginfo.h|6 +--
 arch/blackfin/include/uapi/asm/signal.h |6 +--
 arch/blackfin/include/uapi/asm/stat.h   |6 +--
 arch/blackfin/include/uapi/asm/swab.h   |6 +--
 arch/blackfin/mach-bf533/boards/stamp.c |   47 +++-
 arch/blackfin/mach-bf609/Kconfig|6 +++
 arch/blackfin/mach-bf609/clock.c|3 +-
 arch/blackfin/mach-bf609/include/mach/anomaly.h |   54 ++-
 arch/blackfin/mach-common/cache-c.c |   11 -
 arch/blackfin/mach-common/clocks-init.c |1 -
 arch/blackfin/mach-common/ints-priority.c   |   41 +
 arch/blackfin/mach-common/scb-init.c|1 -
 arch/blackfin/mach-common/smp.c |6 +--
 34 files changed, 166 insertions(+), 83 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [GIT PULL] x86/kaslr for v3.14

2014-01-29 Thread Ingo Molnar

* Linus Torvalds  wrote:

> On Tue, Jan 28, 2014 at 11:48 AM, Ingo Molnar  wrote:
> >
> > I really meant it when I said I build without debuginfo! :)
> 
> Ok, but so what?
> 
> As mentioned, nobody sane should build with DEBUG_INFO. But a normal 
> vmlinux file has the symbol information even without it.

So, your mail sure read to me as a rant directed at me, so I thought 
I'd defend myself or something :)

I now realize that the whole episode was caused by me calling the 
vmlinux 'symbol-less':

> > > > AFAICS this won't work in a symbol-less vmlinux. Is there some 
> > > > trick to do it with gdb?

while I should have said 'debuginfo-less'. Mea culpa.

> > So, when I build a kernel, such as with a regular 'make defconfig',
> > the following happens in gdb:
> >
> >   Reading symbols from /home/mingo/tip/vmlinux...(no debugging symbols 
> > found)...done.
> >   (gdb) list schedule+0x45
> >   No symbol table is loaded.  Use the "file" command.
> >
> > Is there a way to resolve schedule+0x45 in a regular vmlinux? It 
> > was an honest question.
> 
> That seems to be just a gdb bug (or "UI feature"), in that gdb likes 
> to give misleading error messages and requires odd syntax for some 
> things.

Yeah. Almost as if they worked hard to make annoying users go away or 
something. (LLVM is IMO a blessing because, despite its somewhat 
broken licensing, it cured a similar attitude of the GCC folks. In a 
way competition is more important than licensing details!)

> But you can see that the symbol is perfectly fine:
> 
>   (gdb) list *(schedule+0x45)

Oh, cool. Thanks for that trick - this will save me quite some time in 
the future.

So we can strip absolute addresses just fine from oopses - cool.

I'd even argue to strip the hex on non-randomized kernels as long as 
there's kallsyms around, and only print hex if we don't have any 
symbols.

> So my point is that the hex address doesn't give you *anything* that 
> the symbolic address doesn't give you. [...]

Yeah, and with your trick that's now the case for my debugging as 
well, which is a nice touch.

> [...] Unless you do truly crazy things like actively strip the 
> kernel.

Being crazy is something I try to avoid. (Beyond being a maintainer
of a software project as busy and stressful as the Linux kernel that is.)

Thanks,

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] x86: Plug racy xAPIC access of CPU hotplug code

2014-01-29 Thread Jan Kiszka
On 2014-01-28 22:17, Andi Kleen wrote:
> Also with irq-off you of course still always have races against
> the NMI-level machine check.

The self-IPI triggered over NMI won't touch the high-part of the ICR and
will properly wait for ICR to become free again. So we are safe.

Jan

-- 
Siemens AG, Corporate Technology, CT RTC ITP SES-DE
Corporate Competence Center Embedded Linux
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] mm: slub: fix page->_count corruption (again)

2014-01-29 Thread Fengguang Wu
Hi Dave,

> > Fengguang, could you run a set of tests for the top patch in this branch
> > to see if we'd be giving much up by axing the code?
> > 
> > 
> > https://github.com/hansendc/linux/tree/slub-nocmpxchg-for-Fengguang-20140128
> 
> Sure, I've queued tests for the branch. Will report back after 1-2
> days.

btw, just a tip, it would normally cost half time if the branch is
based directly on a mainline (RC) release, eg. v3.13, v3.13-rcX.
Because to evaluate a branch, we need to test&compare its BASE and
HEAD. If the BASE is v3.* kernels, the test infrastructure will very
likely have tested it.

Thanks,
Fengguang
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] kthread: ensure locality of task_struct allocations

2014-01-29 Thread David Rientjes
On Tue, 28 Jan 2014, Nishanth Aravamudan wrote:

> In the presence of memoryless nodes, numa_node_id()/cpu_to_node() will
> return the current CPU's NUMA node, but that may not be where we expect
> to allocate from memory from. Instead, we should use
> numa_mem_id()/cpu_to_mem(). On one ppc64 system with a memoryless Node
> 0, this ends up saving nearly 500M of slab due to less fragmentation.
> 
> Signed-off-by: Nishanth Aravamudan 

Acked-by: David Rientjes 

> diff --git a/kernel/kthread.c b/kernel/kthread.c
> index b5ae3ee..8573e4e 100644
> --- a/kernel/kthread.c
> +++ b/kernel/kthread.c
> @@ -217,7 +217,7 @@ int tsk_fork_get_node(struct task_struct *tsk)
>   if (tsk == kthreadd_task)
>   return tsk->pref_node_fork;
>  #endif
> - return numa_node_id();
> + return numa_mem_id();

I'm wondering why return NUMA_NO_NODE wouldn't have the same effect and 
prefer the local node?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] clk: export __clk_get_hw for re-use in others

2014-01-29 Thread SeongJae Park
Hi,

On Wed, Jan 29, 2014 at 4:29 PM, David Rientjes  wrote:
> On Wed, 22 Jan 2014, SeongJae Park wrote:
>
>> Oops, I've forgot about the merge window. Thank you very much for your
>> kind answer.
>> Sorry if I bothered you while you're in busy time.
>> Because the build problem is not a big deal because it exists only in
>> -next tree,
>
> This problem exists in Linus's tree, not only in -next.

Yes, it looks like the problem caused commit is in Linus's tree
now(Maybe between this merge window).

But, because similar and better patch was
submitted(https://patchwork.kernel.org/patch/3507921/)
before mine by Stephen and Mike said he will merge the patch during rc1 or rc2,
looks like there is nothing we can rather than just waiting rc1 or rc2.

If there is anything I am thinking or doing wrong, please let me know.

Thanks and Regards,
SeongJae Park
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 0/2] Qualcomm Universal Peripheral (QUP) I2C controller

2014-01-29 Thread Ivan T. Ivanov

Hi Bjorn,

On Fri, 2014-01-17 at 15:03 -0800, Bjorn Andersson wrote: 
> Continuing on Ivans i2c-qup series.
> 

Do you plan to send v4 of this driver? I would like to address
the remaining errors and suggestions and send a new version.

Regards,
Ivan

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [GIT PULL] x86/kaslr for v3.14

2014-01-29 Thread Ingo Molnar

* H. Peter Anvin  wrote:

> On 01/28/2014 12:28 PM, Richard Weinberger wrote:
> > Am 28.01.2014 21:25, schrieb Linus Torvalds:
> >> On Tue, Jan 28, 2014 at 12:15 PM, Borislav Petkov  wrote:
> >>>
> >>> Shouldn't we hold that down in the Kconfig help text of DEBUG_INFO?
> >>> Something like:
> >>>
> >>> "You don't need to enable this if you want symbolic names for kernel
> >>> objects. Enable CONFIG_KALLSYMS instead."
> >>
> >> Probably. And then we should make sure that allyesconfig/allmodconfig
> >> don't pick it.
> > 
> > Let's make it depend on CONFIG_EXPERT.
> > 
> 
> That doesn't solve all*config.  My scripts for all*config just 
> overrides it, maybe we need to do something like that by default?

For features we want to exclude from allyesconfig we can define them 
as logical negatives. (I've used this technique in the past to hide 
silly options from allyesconfig and it works well.)

So to reign in debuginfo in allyesconfig/allmodconfig builds we could 
do something like:

 config SAVE_TIME_AND_DISK_SPACE
bool "Faster and leaner kernel build: compile without debug info"
default y

 choice
prompt "Choose DEBUGINFO bloat level"
depends on !SAVE_TIME_AND_DISK_SPACE
default DEBUG_INFO_REDUCED
help
   This option allows to select the debuginfo model.

   config DEBUG_INFO_REDUCED
bool "Reduced amount of debugging information"

   config DEBUG_INFO
bool "Full DEBUG info, 'planet killer' version"

 endchoice

(or so, perhaps with slightly more PC text.)

That would default to Y and would disable debuginfo by default.

( And yeah, it's a bit ugly, but it beats having to hack the kconfig 
  language! )

Thanks,

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [slub shrink] 0f6934bf16: +191.9% vmstat.system.cs

2014-01-29 Thread Fengguang Wu
Hi Dave,

I got more complete results for

https://github.com/hansendc/linux.git 
slub-reshrink-for-Fengguang-20140113,

It looks mostly good.  There are regressions in

- netperf.Throughput_Mbps
- dbench.throughput-MB/sec
- xfstests.generic.256.seconds

However the others are all improvements. 


9a0bb2966efbf30  0f6934bf1695682e7ced973f6  
---  -  
  5766 ~42% -79.3%   1196 ~ 8%  TOTAL fileio.request_latency_max_ms
11 ~44% -73.5%  3 ~27%  TOTAL xfstests.generic.275.seconds
   132 ~37% -56.8% 57 ~10%  TOTAL xfstests.xfs.229.seconds
13 ~47% -60.0%  5 ~ 8%  TOTAL xfstests.xfs.206.seconds
513.33 ~ 9%  +8.2% 555.35 ~ 0%  TOTAL pigz.throughput
44 ~ 9% +29.3% 57 ~16%  TOTAL xfstests.generic.256.seconds
 32321 ~ 7% +14.4%  36987 ~ 9%  TOTAL fileio.requests_per_sec
 15.26 ~ 3% +19.7%  18.26 ~ 4%  TOTAL oltp.request_latency_max_ms
 64742 ~ 6% -10.1%  58179 ~ 4%  TOTAL netperf.Throughput_Mbps
98 ~ 0%  +2.7%101 ~ 0%  TOTAL 
ebizzy.throughput.per_thread.max
167137 ~ 4%  +5.7% 176639 ~ 1%  TOTAL netperf.Throughput_tps
   2276278 ~ 1%  +0.2%2279724 ~ 1%  TOTAL aim7.2000.jobs-per-min
 11213 ~ 0%  +2.1%  11454 ~ 0%  TOTAL ebizzy.throughput
908470 ~ 0%  +0.3% 911314 ~ 0%  TOTAL hackbench.throughput
  8228 ~ 0%  -1.1%   8142 ~ 0%  TOTAL dbench.throughput-MB/sec
161604 ~ 5% +11.0% 179405 ~ 4%  TOTAL iostat.md0.wkB/s

Per test case numbers:

9a0bb2966efbf30  0f6934bf1695682e7ced973f6  
---  -  
  5766 ~42% -79.3%   1196 ~ 8%  
kbuildx/sysbench/fileio/600s-100%-1HDD-ext4-64G-1024-rndrw-sync
  5766 ~42% -79.3%   1196 ~ 8%  TOTAL fileio.request_latency_max_ms

9a0bb2966efbf30  0f6934bf1695682e7ced973f6  
---  -  
11 ~44% -73.5%  3 ~27%  
vpx/micro/xfstests/4HDD-btrfs-generic-mid
11 ~44% -73.5%  3 ~27%  TOTAL xfstests.generic.275.seconds

9a0bb2966efbf30  0f6934bf1695682e7ced973f6  
---  -  
   132 ~37% -56.8% 57 ~10%  vpx/micro/xfstests/4HDD-xfs-xfs
   132 ~37% -56.8% 57 ~10%  TOTAL xfstests.xfs.229.seconds

9a0bb2966efbf30  0f6934bf1695682e7ced973f6  
---  -  
13 ~47% -60.0%  5 ~ 8%  vpx/micro/xfstests/4HDD-xfs-xfs
13 ~47% -60.0%  5 ~ 8%  TOTAL xfstests.xfs.206.seconds

9a0bb2966efbf30  0f6934bf1695682e7ced973f6  
---  -  
464.80 ~ 7%  +5.6% 490.73 ~ 0%  grantley/micro/pigz/100%
 48.53 ~24% +33.1%  64.62 ~ 6%  kbuildx/micro/pigz/100%
513.33 ~ 9%  +8.2% 555.35 ~ 0%  TOTAL pigz.throughput

9a0bb2966efbf30  0f6934bf1695682e7ced973f6  
---  -  
18 ~10% +41.8% 26 ~28%  
vpx/micro/xfstests/4HDD-ext4-generic-mid
26 ~ 9% +20.5% 31 ~ 5%  
vpx/micro/xfstests/4HDD-xfs-generic-mid
44 ~ 9% +29.3% 57 ~16%  TOTAL xfstests.generic.256.seconds

9a0bb2966efbf30  0f6934bf1695682e7ced973f6  
---  -  
   156 ~ 0%  -1.7%153 ~ 0%  
kbuildx/sysbench/fileio/600s-100%-1HDD-btrfs-64G-1024-rndrw-sync
 10766 ~ 5%  +8.5%  11677 ~ 6%  
kbuildx/sysbench/fileio/600s-100%-1HDD-btrfs-64G-1024-seqrewr-sync
 10368 ~15% +30.8%  13560 ~13%  
kbuildx/sysbench/fileio/600s-100%-1HDD-btrfs-64G-1024-seqwr-sync
   124 ~ 3% +36.2%169 ~11%  
kbuildx/sysbench/fileio/600s-100%-1HDD-ext4-64G-1024-rndrd-sync
   943 ~ 2% +84.0%   1736 ~40%  
kbuildx/sysbench/fileio/600s-100%-1HDD-ext4-64G-1024-rndwr-sync
  9962 ~ 0%  -2.7%   9689 ~ 1%  
kbuildx/sysbench/fileio/600s-100%-1HDD-xfs-64G-1024-seqrd-sync
 32321 ~ 7% +14.4%  36987 ~ 9%  TOTAL fileio.requests_per_sec

9a0bb2966efbf30  0f6934bf1695682e7ced973f6  
---  -  
 15.26 ~ 3% +19.7%  18.26 ~ 4%  
nhm-white/sysbench/oltp/600s-100%-100
 15.26 ~ 3% +19.7%  18.26 ~ 4%  TOTAL oltp.request_latency_max_ms

9a0bb2966efbf30  0f6934bf1695682e7ced973f6  
---  -  
  7715 ~ 9% -22.2%   6002 ~16%  
kbuildx/micro/netperf/120s-200%-TCP_MAERTS
 17374 ~11% -16.0%  14591 ~ 6%  
kbuildx/micro/netperf/120s-200%-TCP_SENDFILE
  1650 ~ 0%  -0.7%   1639 ~ 0%  
lkp-a04/micro/netperf/120s-200%-TCP_SENDFILE
   559 ~ 0%  -1.3%552 ~ 0%  
lkp-a04/micro/netperf/120s-200%-TCP_STREAM
  1803 ~18% -45.9%975 ~ 4%  
lkp-nex04/micro/netperf/120s-200%-TCP_MAERTS
  5789 ~ 1%  -4.1%   5551 ~ 0%  
lkp-nex04/micro/netperf/120s-200%-TCP_SENDFILE
  3779 ~ 4% -16

Re: [BUG?] Interrupts enabled after xen_acpi_processor_resume+0x0/0x34 [xen_acpi_processor]

2014-01-29 Thread Stanislaw Gruszka
(Cc: correct Rafael email)

On Tue, Jan 28, 2014 at 09:24:57PM -0800, David Rientjes wrote:
> On Tue, 28 Jan 2014, Konrad Rzeszutek Wilk wrote:
> 
> > diff --git a/drivers/xen/xen-acpi-processor.c 
> > b/drivers/xen/xen-acpi-processor.c
> > index 7231859..7602229 100644
> > --- a/drivers/xen/xen-acpi-processor.c
> > +++ b/drivers/xen/xen-acpi-processor.c
> > @@ -46,7 +46,7 @@ module_param_named(off, no_hypercall, int, 0400);
> >   */
> >  static unsigned int nr_acpi_bits;
> >  /* Mutex to protect the acpi_ids_done - for CPU hotplug use. */
> > -static DEFINE_MUTEX(acpi_ids_mutex);
> > +static DEFINE_SPINLOCK(acpi_ids_lock);
> >  /* Which ACPI ID we have processed from 'struct acpi_processor'. */
> >  static unsigned long *acpi_ids_done;
> >  /* Which ACPI ID exist in the SSDT/DSDT processor definitions. */
> > @@ -68,7 +68,7 @@ static int push_cxx_to_hypervisor(struct acpi_processor 
> > *_pr)
> > int ret = 0;
> >  
> > dst_cx_states = kcalloc(_pr->power.count,
> > -   sizeof(struct xen_processor_cx), GFP_KERNEL);
> > +   sizeof(struct xen_processor_cx), GFP_ATOMIC);
> > if (!dst_cx_states)
> > return -ENOMEM;
> >  
> > @@ -149,7 +149,7 @@ xen_copy_pss_data(struct acpi_processor *_pr,
> >  sizeof(struct acpi_processor_px));
> >  
> > dst_states = kcalloc(_pr->performance->state_count,
> > -sizeof(struct xen_processor_px), GFP_KERNEL);
> > +sizeof(struct xen_processor_px), GFP_ATOMIC);
> > if (!dst_states)
> > return ERR_PTR(-ENOMEM);
> >  
> > @@ -275,9 +275,9 @@ static int upload_pm_data(struct acpi_processor *_pr)
> >  {
> > int err = 0;
> >  
> > -   mutex_lock(&acpi_ids_mutex);
> > +   spin_lock(&acpi_ids_lock);
> > if (__test_and_set_bit(_pr->acpi_id, acpi_ids_done)) {
> > -   mutex_unlock(&acpi_ids_mutex);
> > +   spin_unlock(&acpi_ids_lock);
> > return -EBUSY;
> > }
> > if (_pr->flags.power)
> > @@ -286,7 +286,7 @@ static int upload_pm_data(struct acpi_processor *_pr)
> > if (_pr->performance && _pr->performance->states)
> > err |= push_pxx_to_hypervisor(_pr);
> >  
> > -   mutex_unlock(&acpi_ids_mutex);
> > +   spin_unlock(&acpi_ids_lock);
> > return err;
> >  }
> >  static unsigned int __init get_max_acpi_id(void)
> 
> Looks incomplete, what about the kzalloc() in 
> xen_upload_processor_pm_data() and kcalloc()s in check_acpi_ids()?

Indeed and additionally from check_acpi_ids() we call
acpi_walk_namespace(), which also take mutexes. Hence unfortunately
making xen_upload_processor_pm_data() atomic is not easy, but possibly
can be done by saving some data in memory after initialization.

Or perhaps this problem can be solved differently, by not using 
yscore_ops->resume(), but some other resume callback from core, which
allow to sleep. Than can require registering dummy device or sysfs
class, but maybe there are simpler solutions.

Thanks
Stanislaw 
 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [GIT PULL] x86/kaslr for v3.14

2014-01-29 Thread Mathias Krause
On 29 January 2014 09:11, Ingo Molnar  wrote:
>> But you can see that the symbol is perfectly fine:
>>
>>   (gdb) list *(schedule+0x45)
>
> Oh, cool. Thanks for that trick - this will save me quite some time in
> the future.
>
> So we can strip absolute addresses just fine from oopses - cool.
>
> I'd even argue to strip the hex on non-randomized kernels as long as
> there's kallsyms around, and only print hex if we don't have any
> symbols.

Please, don't do so! I do find the hex values in the backtrace *very*
useful as I'm using 'objdump -wdr vmlinux | less' quite often to
"browse around" in the kernel binary. Grepping for addresses from a
backtrace works quite nicely this way. Having to lookup symbols and do
base-16 arithmetics in the head (or a shell, for that matter) would
only slow down this process. So, please leave the hex values in place.
They do help a lot -- at least in the non-kASLR case.

Regards,
Mathias
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] i2c-designware-pcidrv: fix the incorrect return of idle callback

2014-01-29 Thread Mika Westerberg
On Tue, Jan 28, 2014 at 07:30:35PM +0100, Wolfram Sang wrote:
> On Tue, Jan 28, 2014 at 01:48:28PM +0800, xinhui.pan wrote:
> > From: "xinhui.pan" 
> > 
> > i2c_dw_pci_runtime_idle should return -EBUSY rather than zero if it do 
> > success.
> 
> I don't understand...
> 
> > Otherwise rpm_idle will call pm_suspend again and that may cause 
> > pm_schedule_suspend delay invalidate.
> > 
> > Signed-off-by: bo.he 
> > Signed-off-by: xinhui.pan 
> > ---
> >  drivers/i2c/busses/i2c-designware-pcidrv.c |4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c 
> > b/drivers/i2c/busses/i2c-designware-pcidrv.c
> > index f6ed06c..96e81f6 100644
> > --- a/drivers/i2c/busses/i2c-designware-pcidrv.c
> > +++ b/drivers/i2c/busses/i2c-designware-pcidrv.c
> > @@ -190,8 +190,8 @@ static int i2c_dw_pci_runtime_idle(struct device *dev)
> > int err = pm_schedule_suspend(dev, 500);
> > dev_dbg(dev, "runtime_idle called\n");
> >  
> > -   if (err != 0)
> > -   return 0;
> > +   if (err)
> > +   return err;
> > return -EBUSY;
> 
> ... it does return EBUSY when pm_schedule_suspend() succeeds? It only
> returns 0 if it does not succeed (for which I don't know if this is an
> apropriate behaviour). Mika?

If I understand correctly, pm_schedule_suspend(dev, 500) is there because
we want to runtime suspend in 500 ms. It then returns -EBUSY to prevent PM
runtime from carrying on suspend on it's own. However, I have no idea where
this magical 500 ms requirement comes from.

If we fail to schedule suspend we let the PM core to do whatever it thinks
suitable (in this case I suppose it suspends the device).

I think the whole idle dance could be replaced with a use of runtime PM
autosuspend, just like we do in the platform version of the driver.

Xinghui,

Is this a real problem that you are trying to solve?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] mm: slub: fix page->_count corruption (again)

2014-01-29 Thread David Rientjes
On Tue, 28 Jan 2014, Dave Hansen wrote:

> It has measurable performance benefits, and the benefits go up as the
> cost of en/disabling interrupts goes up (like if it takes you a hypercall).
> 
> Fengguang, could you run a set of tests for the top patch in this branch
> to see if we'd be giving much up by axing the code?
> 
>   
> https://github.com/hansendc/linux/tree/slub-nocmpxchg-for-Fengguang-20140128
> 
> I was talking with one of the distros about turning it off as well.
> They mentioned that they saw a few performance regressions when it was
> turned off.  I'll share details when I get them.
> 

FWIW, I've compared netperf TCP_RR on all machine types I have available 
with and without cmpxchg_double and I've never measured a regression.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: WaitForMultipleObjects/etc. In Kernel

2014-01-29 Thread Clemens Ladisch
Network Nut wrote:
>I was looking at POSIX because it allows naming of the primitives.

Linux uses two orthogonal mechanisms for synchronization
primitives and for naming/sharing.

>I need to epoll_wait on inter-process {mutex, event, semaphore}.

Use eventfd.

>I need to reference inter-process {mutex, event, semaphore}, each
>identified
>by string, if feasible.

Send the fd through a Unix domain socket.


Regards,
Clemens

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


About gpio-regulator setting on DT

2014-01-29 Thread Kuninori Morimoto

Hi Lee, Mark, Liam

I would like to use ${LINUX}/drivers/gpio-regulator.c
via DT.
My board needs "GPIOF_OUT_INIT_HIGH" on
struct gpio :: flags

But, current of_get_gpio_regulator_config()
seems doesn't have such setting method.
This means it will be "GPIOF_OUT_INIT_LOW"

for (i = 0; i < config->nr_gpios; i++) {
gpio = of_get_named_gpio(np, "gpios", i);
if (gpio < 0)
break;
config->gpios[i].gpio = gpio;
}

How to set GPIOF_OUT_INIT_HIGH via DT ?
Or, am I misunderstanding ?

Best regards
---
Kuninori Morimoto
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [git pull] Please pull powerpc.git next branch

2014-01-29 Thread Olaf Hering
On Wed, Jan 29, Alistair Popple wrote:

> Looks like I missed the dart iommu code when changing the iommu table
> initialisation. The patch below should fix it, would you mind testing it Ben?

> +++ b/arch/powerpc/sysdev/dart_iommu.c

> + iommu_table_dart.it_page_shift = IOMMU_PAGE_SHIFT_4K;


Yes, that fixes it for me. Thanks!

Olaf
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: compile error on linus git with ppc64

2014-01-29 Thread Benjamin Herrenschmidt
On Tue, 2014-01-28 at 19:59 -0800, David Rientjes wrote:
> On Tue, 28 Jan 2014, Jesse Brandeburg wrote:


I have a fix queued up in next, I'll ask Linus to pull tomorrow.

Ben.

> > fresh pull, commit d891ea23d5203e5c47439b2a174f86a00b356a6c - merge
> > ceph-client.
> > 
> > I get a compile error:
> > jbrandeb@jbrandeb-pseries:~/git/linux> make -j12
> > scripts/kconfig/conf --silentoldconfig Kconfig
> >   CHK include/config/kernel.release
> >   WRAParch/powerpc/include/generated/asm/clkdev.h
> >   WRAParch/powerpc/include/generated/asm/rwsem.h
> >   WRAParch/powerpc/include/generated/asm/trace_clock.h
> >   WRAParch/powerpc/include/generated/asm/preempt.h
> >   WRAParch/powerpc/include/generated/asm/hash.h
> >   WRAParch/powerpc/include/generated/asm/vtime.h
> >   CHK include/generated/uapi/linux/version.h
> >   UPD include/generated/uapi/linux/version.h
> >   HOSTCC  scripts/dtc/checks.o
> >   HOSTCC  scripts/dtc/data.o
> >   SHIPPED scripts/dtc/dtc-lexer.lex.c
> >   SHIPPED scripts/dtc/dtc-parser.tab.h
> >   HOSTCC  scripts/kallsyms
> >   HOSTCC  scripts/genksyms/genksyms.o
> >   CC  scripts/mod/empty.o
> >   HOSTCC  scripts/mod/mk_elfconfig
> >   CC  scripts/mod/devicetable-offsets.s
> >   SHIPPED scripts/dtc/dtc-parser.tab.c
> >   HOSTCC  scripts/dtc/dtc.o
> >   SHIPPED scripts/genksyms/lex.lex.c
> >   SHIPPED scripts/genksyms/keywords.hash.c
> >   HOSTCC  scripts/pnmtologo
> >   SHIPPED scripts/genksyms/parse.tab.h
> >   SHIPPED scripts/genksyms/parse.tab.c
> >   HOSTCC  scripts/dtc/flattree.o
> >   HOSTCC  scripts/dtc/fstree.o
> >   HOSTCC  scripts/genksyms/lex.lex.o
> >   HOSTCC  scripts/genksyms/parse.tab.o
> >   HOSTCC  scripts/dtc/livetree.o
> >   HOSTCC  scripts/dtc/srcpos.o
> >   HOSTCC  scripts/dtc/treesource.o
> >   HOSTCC  scripts/conmakehash
> >   HOSTCC  scripts/bin2c
> >   MKELF   scripts/mod/elfconfig.h
> >   HOSTCC  scripts/dtc/util.o
> >   HOSTCC  scripts/mod/modpost.o
> >   HOSTCC  scripts/mod/sumversion.o
> >   HOSTCC  scripts/dtc/dtc-lexer.lex.o
> >   HOSTLD  scripts/genksyms/genksyms
> >   HOSTCC  scripts/dtc/dtc-parser.tab.o
> >   GEN scripts/mod/devicetable-offsets.h
> >   HOSTCC  scripts/mod/file2alias.o
> >   HOSTLD  scripts/dtc/dtc
> >   HOSTLD  scripts/mod/modpost
> >   UPD include/config/kernel.release
> >   CHK include/generated/utsrelease.h
> >   UPD include/generated/utsrelease.h
> >   CC  kernel/bounds.s
> >   GEN include/generated/bounds.h
> >   CC  arch/powerpc/kernel/asm-offsets.s
> > In file included from include/linux/spinlock.h:81,
> >  from include/linux/seqlock.h:35,
> >  from include/linux/time.h:5,
> >  from include/uapi/linux/timex.h:56,
> >  from include/linux/timex.h:56,
> >  from include/linux/sched.h:17,
> >  from arch/powerpc/kernel/asm-offsets.c:17:
> > include/linux/spinlock_types.h:76: error: redefinition of typedef
> > ‘spinlock_t’ 
> > /home/jbrandeb/git/linux/arch/powerpc/include/asm/pgtable-ppc64.h:563:
> > error: previous declaration of ‘spinlock_t’ was here
> 
> Confirmed, I saw this with ppc64_defconfig.  It's due to b3084f4db3ae 
> ("powerpc/thp: Fix crash on mremap").
> 
> 
> powerpc, spinlock: fix build error
> 
> Build fails with
> 
> include/linux/spinlock_types.h:76: error: redefinition of typedef 
> ‘spinlock_t’ 
> arch/powerpc/include/asm/pgtable-ppc64.h:563: error: previous declaration of 
> ‘spinlock_t’ was here
> 
> due to commit b3084f4db3ae ("powerpc/thp: Fix crash on mremap").  Remove 
> the bogus typedef and include spinlock_types.h.
> 
> Reported-by: Jesse Brandeburg 
> Signed-off-by: David Rientjes 
> ---
>  arch/powerpc/include/asm/pgtable-ppc64.h | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/include/asm/pgtable-ppc64.h 
> b/arch/powerpc/include/asm/pgtable-ppc64.h
> --- a/arch/powerpc/include/asm/pgtable-ppc64.h
> +++ b/arch/powerpc/include/asm/pgtable-ppc64.h
> @@ -365,6 +365,8 @@ void pgtable_cache_init(void);
>_PAGE_THP_HUGE)
>  
>  #ifndef __ASSEMBLY__
> +#include 
> +
>  /*
>   * The linux hugepage PMD now include the pmd entries followed by the address
>   * to the stashed pgtable_t. The stashed pgtable_t contains the hpte bits.
> @@ -560,7 +562,6 @@ extern void pmdp_invalidate(struct vm_area_struct *vma, 
> unsigned long address,
>   pmd_t *pmdp);
>  
>  #define pmd_move_must_withdraw pmd_move_must_withdraw
> -typedef struct spinlock spinlock_t;
>  static inline int pmd_move_must_withdraw(spinlock_t *new_pmd_ptl,
>spinlock_t *old_pmd_ptl)
>  {


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[GIT] IDE

2014-01-29 Thread David Miller

Two header file inclusion fixes from Rashika Kheria.

Please pull, thanks a lot!

The following changes since commit 0e47c969c65e213421450c31043353ebe3c67e0c:

  Merge tag 'for-linus-20140127' of git://git.infradead.org/linux-mtd 
(2014-01-28 18:56:37 -0800)

are available in the git repository at:


  git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide.git master

for you to fetch changes up to 61eae5bb06496a6633ba000a1d7546b494e00081:

  drivers: ide: Include appropriate header file in ide-pio-blacklist.c 
(2014-01-28 23:35:09 -0800)


Rashika Kheria (2):
  drivers: ide: Include appropriate header file in ide-cd_verbose.c
  drivers: ide: Include appropriate header file in ide-pio-blacklist.c

 drivers/ide/ide-cd_verbose.c| 2 ++
 drivers/ide/ide-pio-blacklist.c | 1 +
 2 files changed, 3 insertions(+)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[GIT] Sparc

2014-01-29 Thread David Miller

Two cleanups from Paul Gortmaker and hook up the new scheduler
system calls.

Please pull, thanks a lot!

The following changes since commit 0e47c969c65e213421450c31043353ebe3c67e0c:

  Merge tag 'for-linus-20140127' of git://git.infradead.org/linux-mtd 
(2014-01-28 18:56:37 -0800)

are available in the git repository at:


  git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc.git master

for you to fetch changes up to a54983ae64b12cf7e098c464c7eaf058752bc9cc:

  sparc: Hook up sched_setattr and sched_getattr syscalls. (2014-01-29 00:45:06 
-0800)


David S. Miller (1):
  sparc: Hook up sched_setattr and sched_getattr syscalls.

Paul Gortmaker (2):
  sparc: delete non-required instances of include 
  sparc: don't use module_init in non-modular pci.c code

 arch/sparc/include/uapi/asm/unistd.h | 4 +++-
 arch/sparc/kernel/cpumap.c   | 1 -
 arch/sparc/kernel/ebus.c | 1 -
 arch/sparc/kernel/hvtramp.S  | 1 -
 arch/sparc/kernel/of_device_common.c | 1 -
 arch/sparc/kernel/pci.c  | 3 +--
 arch/sparc/kernel/pci_common.c   | 1 -
 arch/sparc/kernel/process_32.c   | 1 -
 arch/sparc/kernel/sparc_ksyms_32.c   | 1 -
 arch/sparc/kernel/sparc_ksyms_64.c   | 1 -
 arch/sparc/kernel/systbls_32.S   | 2 +-
 arch/sparc/kernel/systbls_64.S   | 4 ++--
 arch/sparc/kernel/trampoline_32.S| 1 -
 arch/sparc/kernel/trampoline_64.S| 1 -
 arch/sparc/mm/hugetlbpage.c  | 1 -
 arch/sparc/mm/tlb.c  | 1 -
 arch/sparc/prom/p1275.c  | 1 -
 drivers/sbus/char/bbc_i2c.c  | 1 -
 drivers/sbus/char/display7seg.c  | 1 -
 drivers/sbus/char/envctrl.c  | 1 -
 drivers/sbus/char/flash.c| 1 -
 drivers/sbus/char/uctrl.c| 1 -
 22 files changed, 7 insertions(+), 24 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Xen-devel] [PATCH 3/3] xen-blkback: fix shutdown race

2014-01-29 Thread Jan Beulich
>>> On 28.01.14 at 18:43, Roger Pau Monne  wrote:
> --- a/drivers/block/xen-blkback/blkback.c
> +++ b/drivers/block/xen-blkback/blkback.c
> @@ -985,17 +985,31 @@ static void __end_block_io_op(struct pending_req 
> *pending_req, int error)
>* the proper response on the ring.
>*/
>   if (atomic_dec_and_test(&pending_req->pendcnt)) {
> - xen_blkbk_unmap(pending_req->blkif,
> + struct xen_blkif *blkif = pending_req->blkif;
> +
> + xen_blkbk_unmap(blkif,
>   pending_req->segments,
>   pending_req->nr_pages);
> - make_response(pending_req->blkif, pending_req->id,
> + make_response(blkif, pending_req->id,
> pending_req->operation, pending_req->status);
> - xen_blkif_put(pending_req->blkif);
> - if (atomic_read(&pending_req->blkif->refcnt) <= 2) {
> - if (atomic_read(&pending_req->blkif->drain))
> - complete(&pending_req->blkif->drain_complete);
> + free_req(blkif, pending_req);
> + /*
> +  * Make sure the request is freed before releasing blkif,
> +  * or there could be a race between free_req and the
> +  * cleanup done in xen_blkif_free during shutdown.
> +  *
> +  * NB: The fact that we might try to wake up pending_free_wq
> +  * before drain_complete (in case there's a drain going on)
> +  * it's not a problem with our current implementation
> +  * because we can assure there's no thread waiting on
> +  * pending_free_wq if there's a drain going on, but it has
> +  * to be taken into account if the current model is changed.
> +  */
> + xen_blkif_put(blkif);
> + if (atomic_read(&blkif->refcnt) <= 2) {
> + if (atomic_read(&blkif->drain))
> + complete(&blkif->drain_complete);
>   }
> - free_req(pending_req->blkif, pending_req);
>   }
>  }

The put is still too early imo - you're explicitly accessing field in the
structure immediately afterwards. This may not be an issue at
present, but I think it's at least a latent one.

Apart from that, the two if()s would - at least to me - be more
clear if combined into one.

Jan

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: linux-next: manual merge of the clk tree with Linus' tree

2014-01-29 Thread Nicolas Ferre
On 29/01/2014 04:25, Stephen Rothwell :
> Hi Mike,
> 
> Today's linux-next merge of the clk tree got a conflict in
> drivers/clk/Makefile between commit 0ad6125b1579 ("clk: at91: add PMC
> base support") from Linus' tree and commit fd3fdaf09f26 ("clk: sort
> Makefile") from the clk tree.
> 
> I fixed it up (see below) and can carry the fix as necessary (no action
> is required).

Your fix is correct. Thanks Stephen.

Best regards,
-- 
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[GIT] Networking

2014-01-29 Thread David Miller

Several fixups, of note:

1) Fix unlock of not held spinlock in RXRPC code, from Alexey
   Khoroshilov.

2) Call pci_disable_device() from the correct shutdown path in
   bnx2x driver, from Yuval Mintz.

3) Fix qeth build on s390 for some configurations, from Eugene
   Crosser.

4) Cure locking bugs in bond_loadbalance_arp_mon(), from Ding
   Tianhong.

5) Must do netif_napi_add() before registering netdevice in sky2
   driver, from Stanislaw Gruszka.

6) Fix lost bug fix during merge due to code movement in ieee802154,
   noticed and fixed by the eagle eyed Stephen Rothwell.

7) Get rid of resource leak in xen-netfront driver, from Annie Li.

8) Bounds checks in qlcnic driver are off by one, from Manish Chopra.

9) TPROXY can leak sockets when TCP early demux is enabled, fix from
   Holger Eitzenberger.

Please pull, thanks a lot!

The following changes since commit 77d143de75812596a58d126606f42d1214e09dde:

  Merge branch 'for-linus' of 
git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml (2014-01-26 11:06:16 -0800)

are available in the git repository at:


  git://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git master

for you to fetch changes up to c044dc2132d19d8c643cdd340f21afcec177c046:

  qeth: fix build of s390 allmodconfig (2014-01-29 00:43:33 -0800)


Alexey Khoroshilov (1):
  RxRPC: do not unlock unheld spinlock in rxrpc_connect_exclusive()

Annie Li (1):
  xen-netfront: fix resource leak in netfront

Dave Jones (2):
  i40e: Add missing braces to i40e_dcb_need_reconfig()
  llc: remove noisy WARN from llc_mac_hdr_init

David S. Miller (4):
  Merge branch 'bonding'
  Merge branch 'qlcnic'
  Merge tag 'rxrpc-20140126' of git://git.kernel.org/.../dhowells/linux-fs
  Merge branch 'DT'

Ding Tianhong (1):
  bonding: fix locking in bond_loadbalance_arp_mon()

Duan Jiong (1):
  net: gre: use icmp_hdr() to get inner ip header

Eugene Crosser (1):
  qeth: fix build of s390 allmodconfig

Florian Westphal (1):
  net: add and use skb_gso_transport_seglen()

Geert Uytterhoeven (1):
  net/apne: Remove unused variable ei_local

Haiyang Zhang (1):
  hyperv: Add support for physically discontinuous receive buffer

Hans de Goede (2):
  net: stmmac: Silence PTP init errors on hw without PTP
  net: stmmac: Log MAC address only once

Holger Eitzenberger (1):
  net: Fix memory leak if TPROXY used with TCP early demux

Manish Chopra (1):
  qlcnic: Correct off-by-one errors in bounds checks

Martin Schwenke (1):
  net: Document promote_secondaries

Masanari Iida (1):
  net: Fix warning on make htmldocs caused by skbuff.c

Masatake YAMATO (1):
  tun: add device name(iff) field to proc fdinfo entry

Neil Horman (1):
  AF_PACKET: Add documentation for queue mapping fanout mode

Rajesh Borundia (2):
  qlcnic: Fix initialization of vlan list.
  qlcnic: Fix tx timeout.

Sachin Kamat (1):
  net: ipv4: Use PTR_ERR_OR_ZERO

Sergei Shtylyov (2):
  DT: net: davinci_emac: "ti, davinci-rmii-en" property is actually optional
  DT: net: davinci_emac: "ti, davinci-no-bd-ram" property is actually 
optional

Shahed Shaikh (1):
  qlcnic: Fix loopback test failure

Stanislaw Gruszka (1):
  sky2: initialize napi before registering device

Stephen Rothwell (1):
  net: 6lowpan: fixup for code movement

Tim Smith (2):
  af_rxrpc: Avoid setting up double-free on checksum error
  af_rxrpc: Handle frames delivered from another VM

Veaceslav Falico (2):
  bonding: RCUify bond_ab_arp_probe
  bonding: restructure locking of bond_ab_arp_probe()

Yaniv Rosner (1):
  bnx2x: Fix generic option settings

Yuval Mintz (1):
  bnx2x: More Shutdown revisions

 Documentation/devicetree/bindings/net/davinci_emac.txt   |  4 +-
 Documentation/networking/ip-sysctl.txt   |  6 +++
 Documentation/networking/packet_mmap.txt |  1 +
 drivers/hv/channel.c | 14 +++---
 drivers/net/bonding/bond_main.c  | 96 
--
 drivers/net/bonding/bonding.h| 13 ++
 drivers/net/ethernet/8390/apne.c |  1 -
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c  | 78 
+-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c |  4 +-
 drivers/net/ethernet/intel/i40e/i40e_main.c  |  3 +-
 drivers/net/ethernet/marvell/sky2.c  |  4 +-
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c   | 19 ++---
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c |  9 +---
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c | 11 +++--
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c|  6 +--
 drivers/net/hyperv/hyperv_net.h  |  2 +-
 drivers/net/hyperv/netvsc.c  |

Re: [PATCH 3/6] cgroup: clean up cgroup_subsys names and initialization

2014-01-29 Thread Michal Hocko
On Tue 28-01-14 18:43:58, Tejun Heo wrote:
> cgroup_subsys is a bit messier than it needs to be.
> 
> * The name of a subsys can be different from its internal identifier
>   defined in cgroup_subsys.h.  Most subsystems use the matching name
>   but three - cpu, memory and perf_event - use different ones.
> 
> * cgroup_subsys_id enums are postfixed with _subsys_id and each
>   cgroup_subsys is postfixed with _subsys.  cgroup.h is widely
>   included throughout various subsystems, it doesn't and shouldn't
>   have claim on such generic names which don't have any qualifier
>   indicating that they belong to cgroup.
> 
> * cgroup_subsys->subsys_id should always equal the matching
>   cgroup_subsys_id enum; however, we require each controller to
>   initialize it and then BUG if they don't match, which is a bit
>   silly.
> 
> This patch cleans up cgroup_subsys names and initialization by doing
> the followings.
> 
> * cgroup_subsys_id enums are now postfixed with _cgrp_id, and each
>   cgroup_subsys with _cgrp_subsys.
> 
> * With the above, renaming subsys identifiers to match the userland
>   visible names doesn't cause any naming conflicts.  All non-matching
>   identifiers are renamed to match the official names.
> 
>   cpu_cgroup -> cpu
>   mem_cgroup -> memory
>   perf -> perf_event
> 
> * controllers no longer need to initialize ->subsys_id and ->name.
>   They're generated in cgroup core and set automatically during boot.
> 
> * Redundant cgroup_subsys declarations removed.
> 
> * While updating BUG_ON()s in cgroup_init_early(), convert them to
>   WARN()s.  BUGging that early during boot is stupid - the kernel
>   can't print anything, even through serial console and the trap
>   handler doesn't even link stack frame properly for back-tracing.
> 
> This patch doesn't introduce any behavior changes.
> 
> v2: Rebased on top of fe1217c4f3f7 ("net: net_cls: move cgroupfs
> classid handling into core").
> 
> Signed-off-by: Tejun Heo 
> Acked-by: Neil Horman 
> Acked-by: "David S. Miller" 
> Cc: Ingo Molnar 
> Cc: Peter Zijlstra 
> Cc: Li Zefan 
> Cc: Johannes Weiner 
> Cc: Michal Hocko 
> Cc: Balbir Singh 
> Cc: KAMEZAWA Hiroyuki 
> Cc: Aristeu Rozanski 
> Cc: Serge E. Hallyn 
> Cc: "Rafael J. Wysocki" 
> Cc: Vivek Goyal 
> Cc: Thomas Graf 

I thought I have already acked this one. Anyway
Acked-by: Michal Hocko 

> ---
>  block/blk-cgroup.c |  8 +++-
>  block/blk-cgroup.h |  2 +-
>  fs/bio.c   |  2 +-
>  include/linux/cgroup.h |  7 ---
>  include/linux/cgroup_subsys.h  |  6 +++---
>  include/linux/hugetlb_cgroup.h |  2 +-
>  include/linux/memcontrol.h |  2 +-
>  include/net/cls_cgroup.h   |  2 +-
>  include/net/netprio_cgroup.h   |  2 +-
>  kernel/cgroup.c| 34 --
>  kernel/cgroup_freezer.c|  8 ++--
>  kernel/cpuset.c| 10 --
>  kernel/events/core.c   |  8 +++-
>  kernel/sched/core.c|  6 ++
>  kernel/sched/cpuacct.c |  6 ++
>  mm/hugetlb_cgroup.c|  9 +++--
>  mm/memcontrol.c| 22 ++
>  net/core/netclassid_cgroup.c   |  6 ++
>  net/core/netprio_cgroup.c  |  4 +---
>  net/ipv4/tcp_memcontrol.c  |  2 +-
>  security/device_cgroup.c   |  8 ++--
>  21 files changed, 68 insertions(+), 88 deletions(-)
> 
> diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
> index 660d419..1cef07c 100644
> --- a/block/blk-cgroup.c
> +++ b/block/blk-cgroup.c
> @@ -906,16 +906,14 @@ static int blkcg_can_attach(struct cgroup_subsys_state 
> *css,
>   return ret;
>  }
>  
> -struct cgroup_subsys blkio_subsys = {
> - .name = "blkio",
> +struct cgroup_subsys blkio_cgrp_subsys = {
>   .css_alloc = blkcg_css_alloc,
>   .css_offline = blkcg_css_offline,
>   .css_free = blkcg_css_free,
>   .can_attach = blkcg_can_attach,
> - .subsys_id = blkio_subsys_id,
>   .base_cftypes = blkcg_files,
>  };
> -EXPORT_SYMBOL_GPL(blkio_subsys);
> +EXPORT_SYMBOL_GPL(blkio_cgrp_subsys);
>  
>  /**
>   * blkcg_activate_policy - activate a blkcg policy on a request_queue
> @@ -1105,7 +1103,7 @@ int blkcg_policy_register(struct blkcg_policy *pol)
>  
>   /* everything is in place, add intf files for the new policy */
>   if (pol->cftypes)
> - WARN_ON(cgroup_add_cftypes(&blkio_subsys, pol->cftypes));
> + WARN_ON(cgroup_add_cftypes(&blkio_cgrp_subsys, pol->cftypes));
>   ret = 0;
>  out_unlock:
>   mutex_unlock(&blkcg_pol_mutex);
> diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h
> index 86154ea..453b528 100644
> --- a/block/blk-cgroup.h
> +++ b/block/blk-cgroup.h
> @@ -186,7 +186,7 @@ static inline struct blkcg *css_to_blkcg(struct 
> cgroup_subsys_state *css)
>  
>  static inline struct blkcg *task_blkcg(struct task_struct *tsk)
>  {
> - return css_to_blkcg(task_css(tsk, blkio_subsys_id));
> + return css_to_blkcg(task

Re: compile error on linus git with ppc64

2014-01-29 Thread David Rientjes
On Wed, 29 Jan 2014, Benjamin Herrenschmidt wrote:

> I have a fix queued up in next, I'll ask Linus to pull tomorrow.
> 

Which fix?  From linux-next-20140129:

In file included from include/linux/spinlock.h:81:0,
 from include/linux/seqlock.h:35,
 from include/linux/time.h:5,
 from include/uapi/linux/timex.h:56,
 from include/linux/timex.h:56,
 from include/linux/sched.h:17,
 from arch/powerpc/kernel/asm-offsets.c:17:
include/linux/spinlock_types.h:76:3: error: redefinition of typedef 'spinlock_t'
arch/powerpc/include/asm/pgtable-ppc64.h:563:25: note: previous declaration of 
'spinlock_t' was here
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] HID: i2c-hid: add runtime PM support

2014-01-29 Thread Mika Westerberg
On Tue, Jan 28, 2014 at 09:19:33AM -0500, Benjamin Tissoires wrote:
> On Tue, Jan 28, 2014 at 4:12 AM, Mika Westerberg
>  wrote:
> > On Mon, Jan 27, 2014 at 10:36:25PM -0500, Benjamin Tissoires wrote:
> >> On Tue, Jan 14, 2014 at 5:13 AM, Mika Westerberg
> >>  wrote:
> >> > This patch adds runtime PM support for the HID over I2C driver. When the
> >> > i2c-hid device is first opened we power it on and on the last close we
> >> > power it off.
> >> >
> >> > The implementation is not the most power efficient because it needs some
> >> > interaction from the userspace (e.g close the device node whenever we are
> >> > no more interested in getting events), nevertheless it allows us to save
> >> > some power and works with devices that are not wake capable.
> >> >
> >>
> >> Hi Mika,
> >>
> >> I am a little bit puzzled here. The commit message just says that you
> >> changed the implementation of the power saving with the exact same
> >> behavior...  At least that's what I understand.
> >> Currently, the devices should be put on sleep if nobody is reading,
> >> and back alive if a reader arrives.
> >> I think there is a gain with the patch, but my knowledge of the pm
> >> subsystem is far too limited to see it :(
> >
> > Yes, there should be gain. If there is power domain involved like, ACPI in
> > our case, runtime suspending the device on close will let ACPI to move the
> > device to D3cold (e.g full off) which saves more power.
> 
> Oh, right. So, if you could just put this last sentence in the commit
> message, that would be great.

Sure.

> 
> >
> >> > Signed-off-by: Mika Westerberg 
> >> > ---
> >> >  drivers/hid/i2c-hid/i2c-hid.c | 81 
> >> > ---
> >> >  1 file changed, 54 insertions(+), 27 deletions(-)
> >> >
> >> > diff --git a/drivers/hid/i2c-hid/i2c-hid.c 
> >> > b/drivers/hid/i2c-hid/i2c-hid.c
> >> > index d1f81f52481a..ff767d03d60e 100644
> >> > --- a/drivers/hid/i2c-hid/i2c-hid.c
> >> > +++ b/drivers/hid/i2c-hid/i2c-hid.c
> >> > @@ -25,6 +25,7 @@
> >> >  #include 
> >> >  #include 
> >> >  #include 
> >> > +#include 
> >> >  #include 
> >> >  #include 
> >> >  #include 
> >> > @@ -454,10 +455,18 @@ static void i2c_hid_init_reports(struct hid_device 
> >> > *hid)
> >> > return;
> >> > }
> >> >
> >> > +   /*
> >> > +* The device must be powered on while we fetch initial reports
> >> > +* from it.
> >> > +*/
> >> > +   pm_runtime_get_sync(&client->dev);
> >> > +
> >> > list_for_each_entry(report,
> >> > &hid->report_enum[HID_FEATURE_REPORT].report_list, list)
> >> > i2c_hid_init_report(report, inbuf, ihid->bufsize);
> >> >
> >> > +   pm_runtime_put(&client->dev);
> >> > +
> >> > kfree(inbuf);
> >> >  }
> >> >
> >> > @@ -703,8 +712,8 @@ static int i2c_hid_open(struct hid_device *hid)
> >> >
> >> > mutex_lock(&i2c_hid_open_mut);
> >> > if (!hid->open++) {
> >> > -   ret = i2c_hid_set_power(client, I2C_HID_PWR_ON);
> >> > -   if (ret) {
> >> > +   ret = pm_runtime_get_sync(&client->dev);
> >>
> >> dummy question (kind of late here...). Is there a counter of how many
> >> get/put has been called in pm_runtime which could allow us to get rid
> >> of the hid->open count?
> >
> > There is a counter but I'm not sure if drivers are supposed to use that. I
> > would prefer not to use that.
> 
> ok
> 
> >
> >>
> >> > +   if (ret < 0) {
> >> > hid->open--;
> >> > goto done;
> >> > }
> >> > @@ -712,7 +721,7 @@ static int i2c_hid_open(struct hid_device *hid)
> >> > }
> >> >  done:
> >> > mutex_unlock(&i2c_hid_open_mut);
> >> > -   return ret;
> >> > +   return ret < 0 ? ret : 0;
> >> >  }
> >> >
> >> >  static void i2c_hid_close(struct hid_device *hid)
> >> > @@ -729,37 +738,17 @@ static void i2c_hid_close(struct hid_device *hid)
> >> > clear_bit(I2C_HID_STARTED, &ihid->flags);
> >> >
> >> > /* Save some power */
> >> > -   i2c_hid_set_power(client, I2C_HID_PWR_SLEEP);
> >> > +   pm_runtime_put(&client->dev);
> >> > }
> >> > mutex_unlock(&i2c_hid_open_mut);
> >> >  }
> >> >
> >> > -static int i2c_hid_power(struct hid_device *hid, int lvl)
> >> > -{
> >> > -   struct i2c_client *client = hid->driver_data;
> >> > -   struct i2c_hid *ihid = i2c_get_clientdata(client);
> >> > -   int ret = 0;
> >> > -
> >> > -   i2c_hid_dbg(ihid, "%s lvl:%d\n", __func__, lvl);
> >> > -
> >> > -   switch (lvl) {
> >> > -   case PM_HINT_FULLON:
> >> > -   ret = i2c_hid_set_power(client, I2C_HID_PWR_ON);
> >> > -   break;
> >> > -   case PM_HINT_NORMAL:
> >> > -   ret = i2c_hid_set_power(client, I2C_HID_PWR_SLEEP);
> >> > -   break;
> >> > -   }
> >> > -   return ret;
> >> > -}
> >> > -
> >>

Re: [BISECTED] OMAP: DSS: clk rate mismatch

2014-01-29 Thread Tero Kristo

On 01/28/2014 08:17 PM, Ivaylo Dimitrov wrote:



On 28.01.2014 10:48, Tomi Valkeinen wrote:


I made a somewhat hacky quickfix for beagle. Applying that and the
clk-divider from the link above makes things work for me. However, as I
said, the issue with n900 might be different, but it'd be interesting to
hear if it has any effect.

  Tomi



Applying those 2 patches doesn't help, still get exactly the same warning.

Find attached my clk_summary (with my hacky patch applied, otherwise I
cannot boot the device)

Ivo


It looks like the omap36xx version of the omap96m_alwon_fck is modelled 
improperly in the dts files. I don't have access to omap36xx hardware 
myself, but give a try for the following patch:



From: Tero Kristo 
Date: Wed, 29 Jan 2014 11:03:46 +0200
Subject: [PATCH] ARM: dts: omap36xx: fix omap96m_alwon_fck

OMAP36xx has different hardware implementation for the omap96m_alwon_fck
compared to other OMAP3 variants. Reflect this properly in the dts file.

Signed-off-by: Tero Kristo 
---
 arch/arm/boot/dts/omap36xx-clocks.dtsi |9 +
 1 file changed, 9 insertions(+)

diff --git a/arch/arm/boot/dts/omap36xx-clocks.dtsi 
b/arch/arm/boot/dts/omap36xx-clocks.dtsi

index 2fcf253..24ddf3f 100644
--- a/arch/arm/boot/dts/omap36xx-clocks.dtsi
+++ b/arch/arm/boot/dts/omap36xx-clocks.dtsi
@@ -88,3 +88,12 @@
 <&mcbsp4_ick>, <&uart4_fck>;
};
 };
+
+&omap_96m_alwon_fck {
+   compatible = "ti,divider-clock";
+   clocks = <&omap_192m_alwon_fck>;
+   ti,bit-shift = <12>;
+   ti,max-div = <2>;
+   reg = <0x0a40>;
+   ti,index-starts-at-one;
+};
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [REGRESSION][BISECTED] 3.10.26: net_dma: mark broken (b69ec589136c)

2014-01-29 Thread Dan Williams
On Mon, Jan 27, 2014 at 9:31 AM, Stanislav Fomichev
 wrote:
> For Xeon machines in config we have:
> CONFIG_NET_DMA=y
> # CONFIG_ASYNC_TX_DMA is not set
> # CONFIG_DMATEST is not set
> CONFIG_DCA=m
>
> "net_dma: mark broken" changed it to (no CONFIG_NET_DMA):
> # CONFIG_ASYNC_TX_DMA is not set
> # CONFIG_DMATEST is not set
> CONFIG_DMA_ENGINE_RAID=y
> CONFIG_DCA=m
>
> Since this commit, we started to observe that after machine reboots there
> is some change (1 out of 10) that ksoftirqd/0 will eat 100% CPU#0.
> In this case I see huge number of tasklets executed on CPU#0 (about a million
> each second).
>
> To reproduce I just reboot machine and check ksoftirqd/0 CPU usage, if it's 
> <5%,
> reboot machine again.
>
> I added trace_printk into tasklet_action and I see the same tasklet
> "executed" (it's disabled) over and over:
>  ksoftirqd/0-3 [000] ..s.65.281375: tasklet_action: 
> t=88061e5cddc0 func=ioat3_cleanup_event [ioatdma] count=1
>  ksoftirqd/0-3 [000] ..s.65.281376: tasklet_action: 
> t=88061e5cddc0 func=ioat3_cleanup_event [ioatdma] count=1
>  ksoftirqd/0-3 [000] ..s.65.281376: tasklet_action: 
> t=88061e5cddc0 func=ioat3_cleanup_event [ioatdma] count=1
>  ksoftirqd/0-3 [000] ..s.65.281376: tasklet_action: 
> t=88061e5cddc0 func=ioat3_cleanup_event [ioatdma] count=1
>  ksoftirqd/0-3 [000] ..s.65.281377: tasklet_action: 
> t=88061e5cddc0 func=ioat3_cleanup_event [ioatdma] count=1
>  ksoftirqd/0-3 [000] ..s.65.281377: tasklet_action: 
> t=88061e5cddc0 func=ioat3_cleanup_event [ioatdma] count=1
>  ksoftirqd/0-3 [000] ..s.65.281377: tasklet_action: 
> t=88061e5cddc0 func=ioat3_cleanup_event [ioatdma] count=1
>  ksoftirqd/0-3 [000] ..s.65.281378: tasklet_action: 
> t=88061e5cddc0 func=ioat3_cleanup_event [ioatdma] count=1
>  ksoftirqd/0-3 [000] ..s.65.281378: tasklet_action: 
> t=88061e5cddc0 func=ioat3_cleanup_event [ioatdma] count=1
>  ksoftirqd/0-3 [000] ..s.65.281378: tasklet_action: 
> t=88061e5cddc0 func=ioat3_cleanup_event [ioatdma] count=1
>  ksoftirqd/0-3 [000] ..s.65.281379: tasklet_action: 
> t=88061e5cddc0 func=ioat3_cleanup_event [ioatdma] count=1
>  ksoftirqd/0-3 [000] ..s.65.281379: tasklet_action: 
> t=88061e5cddc0 func=ioat3_cleanup_event [ioatdma] count=1
>  ksoftirqd/0-3 [000] ..s.65.281379: tasklet_action: 
> t=88061e5cddc0 func=ioat3_cleanup_event [ioatdma] count=1
>
> Then I added more printk's and got the following (correct) trace for the case
> when ksoftirqd/0 doesn't consume 100% CPU:
> modprobe-650   [005]  9.553511: ioat_init_channel: 
> tasklet_init(880c13d72500)
>  migration/3-71[003] d... 9.554049: complete: x=88061a6f9df0 
> ret=cpu_stop_signal_done
> migration/15-132   [015] d... 9.554790: complete: x=880c15fe3df0 
> ret=cpu_stop_signal_done
> modprobe-650   [005] ..s. 9.556690: ioat_dma_self_test: 
> init_completion(88061c2bfa18) ret=ioat3_dma_self_test [ioatdma]
> modprobe-650   [005]  9.556693: ioat_dma_self_test: 
> wait_for_completion(88061c2bfa18, 750)
>mount-620   [000] d.h. 9.556694: ioat_dma_do_interrupt_msix: 
> tasklet_schedule(880c13d72500)
>mount-620   [000] d.h. 9.556695: __tasklet_schedule: 
> t=880c13d72500 ret=ioat_dma_do_interrupt_msix [ioatdma]
>mount-620   [000] ..s. 9.556696: tasklet_action: 
> t=880627c03e98 func=ioat3_cleanup_event [ioatdma] count=0
>mount-620   [000] ..s. 9.556699: ioat_dma_test_callback: 
> complete(88061c2bfa18) ret=__cleanup [ioatdma]
>mount-620   [000] d.s. 9.556700: complete: x=88061c2bfa18 
> ret=ioat_dma_test_callback [ioatdma]
>mount-620   [000] d.H. 9.556704: ioat_dma_do_interrupt_msix: 
> tasklet_schedule(880c13d72500)
>mount-620   [000] d.H. 9.556705: __tasklet_schedule: 
> t=880c13d72500 ret=ioat_dma_do_interrupt_msix [ioatdma]
>mount-620   [000] ..s. 9.556705: tasklet_action: 
> t=880627c03e98 func=ioat3_cleanup_event [ioatdma] count=0
> migration/10-107   [010] d... 9.558487: complete: x=880c15f4fdf0 
> ret=cpu_stop_signal_done
> modprobe-650   [011]  9.560545: ioat_dma_self_test: 
> wait_for_completion returned tmo=750
>
> And really weird trace when ksoftirqd/0 consumes 100% CPU:
> modprobe-689   [014]  9.490260: ioat_init_channel: 
> tasklet_init(880c13c8b568)
>  migration/3-71[003] d... 9.491727: complete: x=88061a761df0 
> ret=cpu_stop_signal_done
> migration/13-122   [013] d... 9.492212: complete: x=880c15567df0 
> ret=cpu_stop_signal_done
>  migration/3-71[003] d... 9.493098: complete: x=880c15565df0 
> ret=cpu_stop_signal_done
> modprobe-689   [014] ..s. 9.4936

[PATCH -tip v2 3/8] perf-probe: Show in what binaries/modules probes are set

2014-01-29 Thread Masami Hiramatsu
Show the name of binary file or modules in which the probes
are set with --list option.

Without this change;

  # ./perf probe -m drm drm_av_sync_delay
  # ./perf probe -x perf dso__load_vmlinux

  # ./perf probe -l
probe:drm_av_sync_delay (on drm_av_sync_delay)
probe_perf:dso__load_vmlinux (on 0x0006d110)

With this change;

  # ./perf probe -l
probe:drm_av_sync_delay (on drm_av_sync_delay in drm)
probe_perf:dso__load_vmlinux (on 0x0006d110 in 
/kbuild/ksrc/linux-3/tools/perf/perf)

Signed-off-by: Masami Hiramatsu 
---
 tools/perf/util/probe-event.c |   10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 48498c6..4a9f43b 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -1734,7 +1734,8 @@ static struct strlist 
*get_probe_trace_command_rawlist(int fd)
 }
 
 /* Show an event */
-static int show_perf_probe_event(struct perf_probe_event *pev)
+static int show_perf_probe_event(struct perf_probe_event *pev,
+const char *module)
 {
int i, ret;
char buf[128];
@@ -1750,6 +1751,8 @@ static int show_perf_probe_event(struct perf_probe_event 
*pev)
return ret;
 
printf("  %-20s (on %s", buf, place);
+   if (module)
+   printf(" in %s", module);
 
if (pev->nargs > 0) {
printf(" with");
@@ -1787,7 +1790,8 @@ static int __show_perf_probe_events(int fd, bool 
is_kprobe)
ret = convert_to_perf_probe_event(&tev, &pev,
is_kprobe);
if (ret >= 0)
-   ret = show_perf_probe_event(&pev);
+   ret = show_perf_probe_event(&pev,
+   tev.point.module);
}
clear_perf_probe_event(&pev);
clear_probe_trace_event(&tev);
@@ -1986,7 +1990,7 @@ static int __add_probe_trace_events(struct 
perf_probe_event *pev,
group = pev->group;
pev->event = tev->event;
pev->group = tev->group;
-   show_perf_probe_event(pev);
+   show_perf_probe_event(pev, tev->point.module);
/* Trick here - restore current event/group */
pev->event = (char *)event;
pev->group = (char *)group;


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH -tip v2 1/8] [BUGFIX] perf-probe: Fix to do exit call for symbol maps

2014-01-29 Thread Masami Hiramatsu
Some perf-probe commands do symbol_init() but doesn't
do exit call. This fixes that to call symbol_exit()
and relase machine if needed.
This also merges init_vmlinux() and init_user_exec()
because both of them are doing similar things.
(init_user_exec() just skips init vmlinux related
 symbol maps)

Signed-off-by: Masami Hiramatsu 
---
 tools/perf/util/probe-event.c |  110 +++--
 1 file changed, 61 insertions(+), 49 deletions(-)

diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index a8a9b6c..14c649df 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -73,31 +73,35 @@ static char *synthesize_perf_probe_point(struct 
perf_probe_point *pp);
 static int convert_name_to_addr(struct perf_probe_event *pev,
const char *exec);
 static void clear_probe_trace_event(struct probe_trace_event *tev);
-static struct machine machine;
+static struct machine *host_machine;
 
 /* Initialize symbol maps and path of vmlinux/modules */
-static int init_vmlinux(void)
+static int init_symbol_maps(bool user_only)
 {
int ret;
 
symbol_conf.sort_by_name = true;
-   if (symbol_conf.vmlinux_name == NULL)
-   symbol_conf.try_vmlinux_path = true;
-   else
-   pr_debug("Use vmlinux: %s\n", symbol_conf.vmlinux_name);
+   if (user_only)
+   symbol_conf.try_vmlinux_path = false;
+   else {
+   if (symbol_conf.vmlinux_name == NULL)
+   symbol_conf.try_vmlinux_path = true;
+   else
+   pr_debug("Use vmlinux: %s\n", symbol_conf.vmlinux_name);
+   }
ret = symbol__init();
if (ret < 0) {
pr_debug("Failed to init symbol map.\n");
goto out;
}
 
-   ret = machine__init(&machine, "", HOST_KERNEL_ID);
-   if (ret < 0)
-   goto out;
-
-   if (machine__create_kernel_maps(&machine) < 0) {
-   pr_debug("machine__create_kernel_maps() failed.\n");
-   goto out;
+   if (host_machine || user_only)  /* already initialized */
+   return 0;
+   host_machine = machine__new_host();
+   if (!host_machine) {
+   pr_debug("machine__new_host() failed.\n");
+   symbol__exit();
+   ret = -1;
}
 out:
if (ret < 0)
@@ -105,21 +109,30 @@ out:
return ret;
 }
 
+static void exit_symbol_maps(void)
+{
+   if (host_machine) {
+   machine__delete(host_machine);
+   host_machine = NULL;
+   }
+   symbol__exit();
+}
+
 static struct symbol *__find_kernel_function_by_name(const char *name,
 struct map **mapp)
 {
-   return machine__find_kernel_function_by_name(&machine, name, mapp,
+   return machine__find_kernel_function_by_name(host_machine, name, mapp,
 NULL);
 }
 
 static struct map *kernel_get_module_map(const char *module)
 {
struct rb_node *nd;
-   struct map_groups *grp = &machine.kmaps;
+   struct map_groups *grp = &host_machine->kmaps;
 
/* A file path -- this is an offline module */
if (module && strchr(module, '/'))
-   return machine__new_module(&machine, 0, module);
+   return machine__new_module(host_machine, 0, module);
 
if (!module)
module = "kernel";
@@ -141,7 +154,7 @@ static struct dso *kernel_get_module_dso(const char *module)
const char *vmlinux_name;
 
if (module) {
-   list_for_each_entry(dso, &machine.kernel_dsos, node) {
+   list_for_each_entry(dso, &host_machine->kernel_dsos, node) {
if (strncmp(dso->short_name + 1, module,
dso->short_name_len - 2) == 0)
goto found;
@@ -150,7 +163,7 @@ static struct dso *kernel_get_module_dso(const char *module)
return NULL;
}
 
-   map = machine.vmlinux_maps[MAP__FUNCTION];
+   map = host_machine->vmlinux_maps[MAP__FUNCTION];
dso = map->dso;
 
vmlinux_name = symbol_conf.vmlinux_name;
@@ -173,20 +186,6 @@ const char *kernel_get_module_path(const char *module)
return (dso) ? dso->long_name : NULL;
 }
 
-static int init_user_exec(void)
-{
-   int ret = 0;
-
-   symbol_conf.try_vmlinux_path = false;
-   symbol_conf.sort_by_name = true;
-   ret = symbol__init();
-
-   if (ret < 0)
-   pr_debug("Failed to init symbol map.\n");
-
-   return ret;
-}
-
 static int convert_exec_to_group(const char *exec, char **result)
 {
char *ptr1, *ptr2, *exec_copy;
@@ -563,7 +562,7 @@ static int _show_one_line(FILE *fp, int l, bool skip, bool 
show_num)
  * Show line-range always requires debuginfo to find source file and
  * line number.
  */
-int sho

[PATCH -tip v2 8/8] perf-probe: Allow to add events on the local functions

2014-01-29 Thread Masami Hiramatsu
Allow to add events on the local functions without debuginfo.
(With the debuginfo, we can add events even on inlined functions)
Currently, probing on local functions requires debuginfo to
locate actual address. It is also possible without debuginfo since
we have symbol maps.

Without this change;
  
  # ./perf probe -a t_show
  Added new event:
probe:t_show (on t_show)

  You can now use it in all perf tools, such as:

  perf record -e probe:t_show -aR sleep 1

  # ./perf probe -x perf -a identity__map_ip
  no symbols found in /kbuild/ksrc/linux-3/tools/perf/perf, maybe install a 
debug package?
  Failed to load map.
Error: Failed to add events. (-22)
  
As the above results, perf probe just put one event
on the first found symbol for kprobe event. Moreover,
for uprobe event, perf probe failed to find local
functions.

With this change;
  
  # ./perf probe -a t_show
  Added new events:
probe:t_show (on t_show)
probe:t_show_1   (on t_show)
probe:t_show_2   (on t_show)
probe:t_show_3   (on t_show)

  You can now use it in all perf tools, such as:

  perf record -e probe:t_show_3 -aR sleep 1

  # ./perf probe -x perf -a identity__map_ip
  Added new events:
probe_perf:identity__map_ip (on identity__map_ip in 
/kbuild/ksrc/linux-3/tools/perf/perf)
probe_perf:identity__map_ip_1 (on identity__map_ip in 
/kbuild/ksrc/linux-3/tools/perf/perf)
probe_perf:identity__map_ip_2 (on identity__map_ip in 
/kbuild/ksrc/linux-3/tools/perf/perf)
probe_perf:identity__map_ip_3 (on identity__map_ip in 
/kbuild/ksrc/linux-3/tools/perf/perf)

  You can now use it in all perf tools, such as:

  perf record -e probe_perf:identity__map_ip_3 -aR sleep 1
  
Now we succeed to put events on every given local functions
for both kprobes and uprobes. :)

Note that this also introduces some symbol rbtree
iteration macros; symbols__for_each, dso__for_each_symbol,
and map__for_each_symbol. These are for walking through
the symbol list in a map.

Signed-off-by: Masami Hiramatsu 
---
 tools/perf/util/dso.h |   10 +
 tools/perf/util/map.h |   10 +
 tools/perf/util/probe-event.c |  348 ++---
 tools/perf/util/symbol.h  |   11 +
 4 files changed, 184 insertions(+), 195 deletions(-)

diff --git a/tools/perf/util/dso.h b/tools/perf/util/dso.h
index cd7d6f0..ab06f1c 100644
--- a/tools/perf/util/dso.h
+++ b/tools/perf/util/dso.h
@@ -102,6 +102,16 @@ struct dso {
char name[0];
 };
 
+/* dso__for_each_symbol - iterate over the symbols of given type
+ *
+ * @dso: the 'struct dso *' in which symbols itereated
+ * @pos: the 'struct symbol *' to use as a loop cursor
+ * @n: the 'struct rb_node *' to use as a temporary storage
+ * @type: the 'enum map_type' type of symbols
+ */
+#define dso__for_each_symbol(dso, pos, n, type)\
+   symbols__for_each_entry(&(dso)->symbols[(type)], pos, n)
+
 static inline void dso__set_loaded(struct dso *dso, enum map_type type)
 {
dso->loaded |= (1 << type);
diff --git a/tools/perf/util/map.h b/tools/perf/util/map.h
index 18068c6..ef18a48 100644
--- a/tools/perf/util/map.h
+++ b/tools/perf/util/map.h
@@ -89,6 +89,16 @@ u64 map__objdump_2mem(struct map *map, u64 ip);
 
 struct symbol;
 
+/* map__for_each_symbol - iterate over the symbols in the given map
+ *
+ * @map: the 'struct map *' in which symbols itereated
+ * @pos: the 'struct symbol *' to use as a loop cursor
+ * @n: the 'struct rb_node *' to use as a temporary storage
+ * Note: caller must ensure map->dso is not NULL (map is loaded).
+ */
+#define map__for_each_symbol(map, pos, n)  \
+   dso__for_each_symbol(map->dso, pos, n, map->type)
+
 typedef int (*symbol_filter_t)(struct map *map, struct symbol *sym);
 
 void map__init(struct map *map, enum map_type type,
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 1d6ced1..5129e9e 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -70,8 +70,6 @@ static int e_snprintf(char *str, size_t size, const char 
*format, ...)
 }
 
 static char *synthesize_perf_probe_point(struct perf_probe_point *pp);
-static int convert_name_to_addr(struct perf_probe_event *pev,
-   const char *exec);
 static void clear_probe_trace_event(struct probe_trace_event *tev);
 static struct machine *host_machine;
 
@@ -222,6 +220,14 @@ out:
return ret;
 }
 
+static void clear_probe_trace_events(struct probe_trace_event *tevs, int ntevs)
+{
+   int i;
+
+   for (i = 0; i < ntevs; i++)
+   clear_probe_trace_event(tevs + i);
+}
+
 #ifdef HAVE_DWARF_SUPPORT
 /* Open new debuginfo of given module */
 static struct debuginfo *open_debuginfo(const char *module)
@@ -432,14 +438,6 @@ static int post_process_probe_trace_events(struct 
probe_trace_event *tevs,
return 0;
 }
 
-static void clear_probe_trace_events(struct probe_trace_even

[PATCH -tip v2 4/8] perf-probe: Use _stext based address instead of the symbol name

2014-01-29 Thread Masami Hiramatsu
Since several local symbols can have same name (e.g. t_show),
we need to use the relative address from _stext instead of
the target symbol name. Because the kernel address space layout
randomize (kaslr) changes the absolute address of kernel symbols,
we can't relay on the absolute address.
Note that this works only with debuginfo.

E.g. without this change;
  
  # ./perf probe -a "t_show \$vars"
  Added new events:
probe:t_show (on t_show with $vars)
probe:t_show_1   (on t_show with $vars)
probe:t_show_2   (on t_show with $vars)
probe:t_show_3   (on t_show with $vars)

  You can now use it in all perf tools, such as:

  perf record -e probe:t_show_3 -aR sleep 1
  
OK, we have 4 different t_show()s. All functions have
different arguments as below;
  
  # cat /sys/kernel/debug/tracing/kprobe_events
  p:probe/t_show t_show m=%di:u64 v=%si:u64
  p:probe/t_show_1 t_show m=%di:u64 v=%si:u64 t=%si:u64
  p:probe/t_show_2 t_show m=%di:u64 v=%si:u64 fmt=%si:u64
  p:probe/t_show_3 t_show m=%di:u64 v=%si:u64 file=%si:u64
  
However, all of them have been put on the *same* address.
  
  # cat /sys/kernel/debug/kprobes/list
  810d9720  k  t_show+0x0[DISABLED]
  810d9720  k  t_show+0x0[DISABLED]
  810d9720  k  t_show+0x0[DISABLED]
  810d9720  k  t_show+0x0[DISABLED]
  

With this change;
  
  # ./perf probe -a "t_show \$vars"
  Added new events:
probe:t_show (on t_show with $vars)
probe:t_show_1   (on t_show with $vars)
probe:t_show_2   (on t_show with $vars)
probe:t_show_3   (on t_show with $vars)

  You can now use it in all perf tools, such as:

  perf record -e probe:t_show_3 -aR sleep 1

  # cat /sys/kernel/debug/tracing/kprobe_events
  p:probe/t_show _stext+889880 m=%di:u64 v=%si:u64
  p:probe/t_show_1 _stext+928568 m=%di:u64 v=%si:u64 t=%si:u64
  p:probe/t_show_2 _stext+969512 m=%di:u64 v=%si:u64 fmt=%si:u64
  p:probe/t_show_3 _stext+1001416 m=%di:u64 v=%si:u64 file=%si:u64

  # cat /sys/kernel/debug/kprobes/list
  b50d95e0  k  t_show+0x0[DISABLED]
  b50e2d00  k  t_show+0x0[DISABLED]
  b50f4990  k  t_show+0x0[DISABLED]
  b50eccf0  k  t_show+0x0[DISABLED]
  
This time, each event is put in different address
correctly.

Note that currently this doesn't support address-based
probe on modules (thus the probes on modules are symbol
based), since it requires relative address probe syntax
for kprobe-tracer, and it doesn't implemented yet.

One more note, this allows us to put events on correct
address, but --list option should be updated to show
correct corresponding source code.

Changes from v1:
  - Use _stext relative address instead of actual
absolute address recorded in debuginfo.

Signed-off-by: Masami Hiramatsu 
---
 tools/perf/util/probe-event.c |   51 ++---
 1 file changed, 42 insertions(+), 9 deletions(-)

diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 4a9f43b..120954b 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -387,6 +387,44 @@ static int add_module_to_probe_trace_events(struct 
probe_trace_event *tevs,
return ret;
 }
 
+/* Post processing the probe events */
+static int post_process_probe_trace_events(struct probe_trace_event *tevs,
+  int ntevs, const char *module,
+  bool uprobe)
+{
+   struct symbol *sym;
+   struct map *map;
+   unsigned long stext = 0;
+   char *tmp;
+   int i;
+
+   if (uprobe)
+   return add_exec_to_probe_trace_events(tevs, ntevs, module);
+
+   /* Note that currently _stext based probe is not for drivers */
+   if (module)
+   return add_module_to_probe_trace_events(tevs, ntevs, module);
+
+   sym = __find_kernel_function_by_name("_stext", &map);
+   if (!sym) {
+   pr_debug("Failed to find _stext. Use original symbol name.\n");
+   return 0;
+   }
+   stext = map->unmap_ip(map, sym->start);
+
+   for (i = 0; i < ntevs; i++) {
+   if (tevs[i].point.address) {
+   tmp = strdup("_stext");
+   if (!tmp)
+   return -ENOMEM;
+   free(tevs[i].point.symbol);
+   tevs[i].point.symbol = tmp;
+   tevs[i].point.offset = tevs[i].point.address - stext;
+   }
+   }
+   return 0;
+}
+
 static void clear_probe_trace_events(struct probe_trace_event *tevs, int ntevs)
 {
int i;
@@ -415,21 +453,16 @@ static int try_to_find_probe_trace_events(struct 
perf_probe_event *pev,
return 0;
}
 
+   pr_debug("Try to find probe point from debuginfo.\n");
/* Searching trace events corresponding to a probe eve

[PATCH -tip v2 7/8] perf-probe: Show source-level or symbol-level info for uprobes

2014-01-29 Thread Masami Hiramatsu
Show source-level or symbol-level information for uprobe events.

Without this change;
  # ./perf probe -l
probe_perf:dso__load_vmlinux (on 0x0006d110 in 
/kbuild/ksrc/linux-3/tools/perf/perf)

With this change;
  # ./perf probe -l
probe_perf:dso__load_vmlinux (on dso__load_vmlinux@util/symbol.c in 
/kbuild/ksrc/linux-3/tools/perf/perf)

Changes from v1:
 - Rewrite the code based on new series.

Signed-off-by: Masami Hiramatsu 
---
 tools/perf/util/probe-event.c |  241 ++---
 1 file changed, 150 insertions(+), 91 deletions(-)

diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 8db172a..1d6ced1 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -222,38 +222,6 @@ out:
return ret;
 }
 
-static int convert_to_perf_probe_point(struct probe_trace_point *tp,
-   struct perf_probe_point *pp)
-{
-   struct symbol *sym;
-   struct map *map;
-   u64 addr;
-
-   /* _stext based probe point is solved to absolute address */
-   if (tp->symbol && strcmp(tp->symbol, "_stext") == 0) {
-   sym = __find_kernel_function_by_name(tp->symbol, &map);
-   if (!sym)
-   goto failed;
-   addr = map->unmap_ip(map, sym->start + tp->offset);
-   sym = __find_kernel_function(addr, &map);
-   if (!sym)
-   goto failed;
-   pp->function = strdup(sym->name);
-   pp->offset = addr - map->unmap_ip(map, sym->start);
-   } else {
-failed:
-   pp->function = strdup(tp->symbol);
-   pp->offset = tp->offset;
-   }
-
-   if (pp->function == NULL)
-   return -ENOMEM;
-
-   pp->retprobe = tp->retprobe;
-
-   return 0;
-}
-
 #ifdef HAVE_DWARF_SUPPORT
 /* Open new debuginfo of given module */
 static struct debuginfo *open_debuginfo(const char *module)
@@ -275,48 +243,6 @@ static struct debuginfo *open_debuginfo(const char *module)
return debuginfo__new(path);
 }
 
-/*
- * Convert trace point to probe point with debuginfo
- * Currently only handles kprobes.
- */
-static int kprobe_convert_to_perf_probe(struct probe_trace_point *tp,
-   struct perf_probe_point *pp)
-{
-   struct symbol *sym;
-   struct map *map;
-   u64 addr;
-   int ret = -ENOENT;
-   struct debuginfo *dinfo;
-
-   sym = __find_kernel_function_by_name(tp->symbol, &map);
-   if (sym) {
-   addr = map->unmap_ip(map, sym->start + tp->offset);
-   pr_debug("try to find %s+%ld@%" PRIx64 "\n", tp->symbol,
-tp->offset, addr);
-
-   dinfo = debuginfo__new_online_kernel(addr);
-   if (!dinfo) /* For kaslr kernel */
-   dinfo = open_debuginfo(tp->module);
-   if (dinfo) {
-   ret = debuginfo__find_probe_point(dinfo,
-(unsigned long)addr, pp);
-   debuginfo__delete(dinfo);
-   } else {
-   pr_debug("Failed to open debuginfo at 0x%" PRIx64 "\n",
-addr);
-   ret = -ENOENT;
-   }
-   }
-   if (ret <= 0) {
-   pr_debug("Failed to find corresponding probes from "
-"debuginfo. Use kprobe event information.\n");
-   return convert_to_perf_probe_point(tp, pp);
-   }
-   pp->retprobe = tp->retprobe;
-
-   return 0;
-}
-
 static int get_text_start_address(const char *exec, unsigned long *address)
 {
Elf *elf;
@@ -345,6 +271,62 @@ out:
return ret;
 }
 
+/*
+ * Convert trace point to probe point with debuginfo
+ */
+static int find_perf_probe_point_from_dwarf(struct probe_trace_point *tp,
+   struct perf_probe_point *pp,
+   bool is_kprobe)
+{
+   struct symbol *sym;
+   struct map *map;
+   int ret = -ENOENT;
+   struct debuginfo *dinfo = NULL;
+   unsigned long stext = 0;
+   u64 addr = tp->address;
+
+   /* convert the address to dwarf address */
+   if (!is_kprobe) {
+   if (!addr) {
+   ret = -EINVAL;
+   goto error;
+   }
+   ret = get_text_start_address(tp->module, &stext);
+   if (ret < 0)
+   goto error;
+   addr += stext;
+   } else {
+   sym = __find_kernel_function_by_name(tp->symbol, &map);
+   if (!sym)
+   goto error;
+   addr = map->unmap_ip(map, sym->start + tp->offset);
+   }
+
+   pr_debug("try to find information at %" PRIx64 " in %s\n", addr,
+tp->module ? : "kernel");
+
+   if (is_k

[PATCH -tip v2 5/8] perf-probe: Retry to find given address from offline dwarf

2014-01-29 Thread Masami Hiramatsu
Retry to find the given address from offline dwarfs too.

On the KASLR enabled kernel, the kernel text section is
loaded with random offset, and debuginfo__new_online_kernel
tries to map the debuginfo with that offset. However,
perf's map object tries to make a non-randomized ummapped
address. This leads to fail looking up the appropriate
debuginfo from that address.

To solve this issue, we retry to use offline dwarfs if
possible.

Without this change;

  # ./perf probe -l
probe:t_show (on _stext+901288 with m v)
probe:t_show_1   (on _stext+939624 with m v t)
probe:t_show_2   (on _stext+980296 with m v fmt)
probe:t_show_3   (on _stext+1014392 with m v file)

With this change;

  # ./perf probe -l
probe:t_show (on t_show@linux-3/kernel/trace/ftrace.c with m v)
probe:t_show_1   (on t_show@linux-3/kernel/trace/trace.c with m v t)
probe:t_show_2   (on t_show@kernel/trace/trace_printk.c with m v fmt)
probe:t_show_3   (on t_show@kernel/trace/trace_events.c with m v file)

Signed-off-by: Masami Hiramatsu 
---
 tools/perf/util/probe-event.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 120954b..b35f047 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -272,6 +272,8 @@ static int kprobe_convert_to_perf_probe(struct 
probe_trace_point *tp,
 tp->offset, addr);
 
dinfo = debuginfo__new_online_kernel(addr);
+   if (!dinfo) /* For kaslr kernel */
+   dinfo = open_debuginfo(tp->module);
if (dinfo) {
ret = debuginfo__find_probe_point(dinfo,
 (unsigned long)addr, pp);


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH -tip v2 6/8] perf-probe: Show appropriate symbol for _stext based kprobes

2014-01-29 Thread Masami Hiramatsu
Show appropriate symbol for _stext based kprobes instead
of _stext+offset when perf-probe -l runs without debuginfo.

Without this change:
  # ./perf probe -l
probe:t_show (on _stext+889880 with m v)
probe:t_show_1   (on _stext+928568 with m v t)
probe:t_show_2   (on _stext+969512 with m v fmt)
probe:t_show_3   (on _stext+1001416 with m v file)

With this change:
  # ./perf probe -l
probe:t_show (on t_show with m v)
probe:t_show_1   (on t_show with m v t)
probe:t_show_2   (on t_show with m v fmt)
probe:t_show_3   (on t_show with m v file)

Signed-off-by: Masami Hiramatsu 
---
 tools/perf/util/probe-event.c |   27 +--
 1 file changed, 25 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index b35f047..8db172a 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -125,6 +125,11 @@ static struct symbol *__find_kernel_function_by_name(const 
char *name,
 NULL);
 }
 
+static struct symbol *__find_kernel_function(u64 addr, struct map **mapp)
+{
+   return machine__find_kernel_function(host_machine, addr, mapp, NULL);
+}
+
 static struct map *kernel_get_module_map(const char *module)
 {
struct rb_node *nd;
@@ -220,12 +225,30 @@ out:
 static int convert_to_perf_probe_point(struct probe_trace_point *tp,
struct perf_probe_point *pp)
 {
-   pp->function = strdup(tp->symbol);
+   struct symbol *sym;
+   struct map *map;
+   u64 addr;
+
+   /* _stext based probe point is solved to absolute address */
+   if (tp->symbol && strcmp(tp->symbol, "_stext") == 0) {
+   sym = __find_kernel_function_by_name(tp->symbol, &map);
+   if (!sym)
+   goto failed;
+   addr = map->unmap_ip(map, sym->start + tp->offset);
+   sym = __find_kernel_function(addr, &map);
+   if (!sym)
+   goto failed;
+   pp->function = strdup(sym->name);
+   pp->offset = addr - map->unmap_ip(map, sym->start);
+   } else {
+failed:
+   pp->function = strdup(tp->symbol);
+   pp->offset = tp->offset;
+   }
 
if (pp->function == NULL)
return -ENOMEM;
 
-   pp->offset = tp->offset;
pp->retprobe = tp->retprobe;
 
return 0;


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH -tip v2 0/8] perf-probe: Updates for handling local functions correctly

2014-01-29 Thread Masami Hiramatsu
Hi,

Here is the 2nd version of the series for handling local
functions correctly with perf-probe.

In this version, I used "_stext" based probe point instead
of absolute address, because KASLR changes the address
offset randomly and the debuginfo doesn't know that offset.

Issue 1)
 Current perf-probe can't handle probe-points for kprobes,
 since it uses symbol-based probe definition. The symbol
 based definition is easy to read and robust for differnt
 kernel and modules. However, when user gives a local
 function name which has several different instances,
 it may put probes on wrong (or unexpected) address.
 On the other hand, since uprobe events are based on the
 actual address, it can avoid this issue.

 E.g.
In the case to probe t_show local functions (which has
4 different instances.
  
  # grep " t_show\$" /proc/kallsyms
  810d9720 t t_show
  810e2e40 t t_show
  810ece30 t t_show
  810f4ad0 t t_show
  # ./perf probe -fa "t_show \$vars"
  Added new events:
probe:t_show (on t_show with $vars)
probe:t_show_1   (on t_show with $vars)
probe:t_show_2   (on t_show with $vars)
probe:t_show_3   (on t_show with $vars)

  You can now use it in all perf tools, such as:

  perf record -e probe:t_show_3 -aR sleep 1
  
OK, we have 4 different t_show()s. All functions have
different arguments as below;
  
  # cat /sys/kernel/debug/tracing/kprobe_events
  p:probe/t_show t_show m=%di:u64 v=%si:u64
  p:probe/t_show_1 t_show m=%di:u64 v=%si:u64 t=%si:u64
  p:probe/t_show_2 t_show m=%di:u64 v=%si:u64 fmt=%si:u64
  p:probe/t_show_3 t_show m=%di:u64 v=%si:u64 file=%si:u64
  
However, all of them have been put on the *same* address.
  
  # cat /sys/kernel/debug/kprobes/list
  810d9720  k  t_show+0x0[DISABLED]
  810d9720  k  t_show+0x0[DISABLED]
  810d9720  k  t_show+0x0[DISABLED]
  810d9720  k  t_show+0x0[DISABLED]
  
 oops...

Issue 2)
 With the debuginfo, issue 1 can be solved by using
 _stext-based probe definition instead of local symbol-based.
 However, without debuginfo, perf-probe can only use
 symbol-map in the binary (or kallsyms). The map provides
 symbol find methods, but it returns only the first matched
 symbol. To put probes on all functions which have given
 symbol, we need a symbol-list iterator for the map.

 E.g. (built perf with NO_DWARF=1)
In the case to probe t_show and identity__map_ip in perf.
  
  # ./perf probe -a t_show
  Added new event:
probe:t_show (on t_show)

  You can now use it in all perf tools, such as:

  perf record -e probe:t_show -aR sleep 1

  # ./perf probe -x perf -a identity__map_ip
  no symbols found in /kbuild/ksrc/linux-3/tools/perf/perf, maybe install a 
debug package?
  Failed to load map.
Error: Failed to add events. (-22)
  
 oops.


Solutions)
To solve the issue 1, this series changes perf probe to
use _stext-based probe definition. This means that we
also need to fix the --list options to analyze actual
probe address from _stext address. (and that has been
done in this series).

E.g. with this series;
  
  # ./perf probe -a "t_show \$vars"
  Added new events:
probe:t_show (on t_show with $vars)
probe:t_show_1   (on t_show with $vars)
probe:t_show_2   (on t_show with $vars)
probe:t_show_3   (on t_show with $vars)

  You can now use it in all perf tools, such as:

  perf record -e probe:t_show_3 -aR sleep 1

  # cat /sys/kernel/debug/tracing/kprobe_events
  p:probe/t_show _stext+889880 m=%di:u64 v=%si:u64
  p:probe/t_show_1 _stext+928568 m=%di:u64 v=%si:u64 t=%si:u64
  p:probe/t_show_2 _stext+969512 m=%di:u64 v=%si:u64 fmt=%si:u64
  p:probe/t_show_3 _stext+1001416 m=%di:u64 v=%si:u64 file=%si:u64

  # cat /sys/kernel/debug/kprobes/list
  b50d95e0  k  t_show+0x0[DISABLED]
  b50e2d00  k  t_show+0x0[DISABLED]
  b50f4990  k  t_show+0x0[DISABLED]
  b50eccf0  k  t_show+0x0[DISABLED]
  
This time we can see the events are set in different
addresses.

And for the issue 2, the last patch introduces symbol
iterators for map, dso and symbols (since the symbol
list is the symbols and it is included dso, and perf
probe accesses dso via map).

E.g. with this series (built perf with NO_DWARF=1);
  
  # ./perf probe -a t_show
  Added new events:
probe:t_show (on t_show)
probe:t_show_1   (on t_show)
probe:t_show_2   (on t_show)
probe:t_show_3   (on t_show)

  You can now use it in all perf tools, such as:

  perf record -e probe:t_show_3 -aR sleep 1

  # ./perf probe -x perf -a identity__map_ip
  Added new events:
probe_perf:identity__map_ip (on identity__map_ip in 
/kbuild/ksrc/linux-3/tools/perf/perf)
probe_perf:identity__map_ip_1 (on identity__map_ip in 
/kbuild/ksrc/linux-3/tools/perf/perf)
probe_perf:identity__map_ip_2 (on identity__map_ip in 
/k

[PATCH -tip v2 2/8] perf-probe: Remove incorrect symbol check for --list

2014-01-29 Thread Masami Hiramatsu
Remove unneeded symbol check for --list option.
This code actually checks whether the given symbol exists
in the kernel. But this is incorrect for online kernel/module
and offline module too.
 - For online kernel/module, the kprobes itself already
  ensured the symbol exist in the kernel.
 - For offline module, this code can't access the offlined
  modules. Ignore it.

Signed-off-by: Masami Hiramatsu 
---
 tools/perf/util/probe-event.c |8 
 1 file changed, 8 deletions(-)

diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 14c649df..48498c6 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -743,14 +743,6 @@ out:
 static int kprobe_convert_to_perf_probe(struct probe_trace_point *tp,
struct perf_probe_point *pp)
 {
-   struct symbol *sym;
-
-   sym = __find_kernel_function_by_name(tp->symbol, NULL);
-   if (!sym) {
-   pr_err("Failed to find symbol %s in kernel.\n", tp->symbol);
-   return -ENOENT;
-   }
-
return convert_to_perf_probe_point(tp, pp);
 }
 


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/9 v5] crypto:s5p-sss: Use platform_get_irq() instead of _byname()

2014-01-29 Thread Naveen Krishna Chatradhi
From: Naveen Krishna Ch 

This patch uses the platform_get_irq() instead of the
platform_get_irq_byname(). Making feeder control interrupt
as resource "0" and hash interrupt as "1".

reasons for this change.
1. Cannot find any Arch which is currently using this driver
2. Samsung Exynos4 and 5 SoCs only use the feeder control interrupt
3. Patches adding support for DT and H/W version are in pipeline

Signed-off-by: Naveen Krishna Ch 
Reviewed-by: Tomasz Figa 
CC: Herbert Xu 
CC: David S. Miller 
CC: Vladimir Zapolskiy 
TO: 
CC: 
---
Changes since v4:
None
Changes since v3:
None
 drivers/crypto/s5p-sss.c |   24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/crypto/s5p-sss.c b/drivers/crypto/s5p-sss.c
index cf149b1..93cddeb 100644
--- a/drivers/crypto/s5p-sss.c
+++ b/drivers/crypto/s5p-sss.c
@@ -592,29 +592,29 @@ static int s5p_aes_probe(struct platform_device *pdev)
pdata->ioaddr = devm_ioremap(dev, res->start,
 resource_size(res));
 
-   pdata->irq_hash = platform_get_irq_byname(pdev, "hash");
-   if (pdata->irq_hash < 0) {
-   err = pdata->irq_hash;
-   dev_warn(dev, "hash interrupt is not available.\n");
+   pdata->irq_fc = platform_get_irq(pdev, 0);
+   if (pdata->irq_fc < 0) {
+   err = pdata->irq_fc;
+   dev_warn(dev, "feed control interrupt is not available.\n");
goto err_irq;
}
-   err = devm_request_irq(dev, pdata->irq_hash, s5p_aes_interrupt,
+   err = devm_request_irq(dev, pdata->irq_fc, s5p_aes_interrupt,
   IRQF_SHARED, pdev->name, pdev);
if (err < 0) {
-   dev_warn(dev, "hash interrupt is not available.\n");
+   dev_warn(dev, "feed control interrupt is not available.\n");
goto err_irq;
}
 
-   pdata->irq_fc = platform_get_irq_byname(pdev, "feed control");
-   if (pdata->irq_fc < 0) {
-   err = pdata->irq_fc;
-   dev_warn(dev, "feed control interrupt is not available.\n");
+   pdata->irq_hash = platform_get_irq(pdev, 1);
+   if (pdata->irq_hash < 0) {
+   err = pdata->irq_hash;
+   dev_warn(dev, "hash interrupt is not available.\n");
goto err_irq;
}
-   err = devm_request_irq(dev, pdata->irq_fc, s5p_aes_interrupt,
+   err = devm_request_irq(dev, pdata->irq_hash, s5p_aes_interrupt,
   IRQF_SHARED, pdev->name, pdev);
if (err < 0) {
-   dev_warn(dev, "feed control interrupt is not available.\n");
+   dev_warn(dev, "hash interrupt is not available.\n");
goto err_irq;
}
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/9 v5] crypto:s5p-sss: Add device tree support

2014-01-29 Thread Naveen Krishna Chatradhi
This patch adds device tree support to the s5p-sss.c crypto driver.

Also, Documentation under devicetree/bindings added.

Signed-off-by: Naveen Krishna Ch 
CC: Herbert Xu 
CC: David S. Miller 
CC: Vladimir Zapolskiy 
TO: 
CC: 
---
Changes since v4:
Modified Documentation to give clock names and example for interrupts

Changes since v3:
None
 .../devicetree/bindings/crypto/samsung-sss.txt |   24 
 drivers/crypto/s5p-sss.c   |8 +++
 2 files changed, 32 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/crypto/samsung-sss.txt

diff --git a/Documentation/devicetree/bindings/crypto/samsung-sss.txt 
b/Documentation/devicetree/bindings/crypto/samsung-sss.txt
new file mode 100644
index 000..d193084
--- /dev/null
+++ b/Documentation/devicetree/bindings/crypto/samsung-sss.txt
@@ -0,0 +1,24 @@
+Samsung SoC SSS (Security SubSystem) module
+
+The SSS module in S5PV210 SoC supports the following:
+-- Feeder (FeedCtrl)
+-- Advanced Encryption Standard (AES)
+-- Data Encryption Standard (DES)/3DES
+-- Public Key Accelerator (PKA)
+-- SHA-1/SHA-256/MD5/HMAC (SHA-1/SHA-256/MD5)/PRNG
+-- PRNG: Pseudo Random Number Generator
+
+Required properties:
+
+- compatible : Should contain entries for this and backward compatible
+  SSS versions:
+  - "samsung,s5pv210-secss" for S5PV210 SoC.
+- reg : Offset and length of the register set for the module
+- interrupts : the interrupt-specifier for the SSS module.
+   Two interrupts "feed control and hash" in case of S5PV210
+  Eg : interrupts = <0 feed-control 0> <0 hash 0>;
+- clocks : list of clock phandle and specifier pairs for all clocks  listed in
+   clock-names property.
+- clock-names : list of device clock input names; should contain one entry
+   "secss".
+
diff --git a/drivers/crypto/s5p-sss.c b/drivers/crypto/s5p-sss.c
index 93cddeb..73c8b38 100644
--- a/drivers/crypto/s5p-sss.c
+++ b/drivers/crypto/s5p-sss.c
@@ -22,6 +22,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -177,6 +178,12 @@ struct s5p_aes_dev {
 
 static struct s5p_aes_dev *s5p_dev;
 
+static const struct of_device_id s5p_sss_dt_match[] = {
+   { .compatible = "samsung,s5pv210-secss" },
+   { },
+};
+MODULE_DEVICE_TABLE(of, s5p_sss_dt_match);
+
 static void s5p_set_dma_indata(struct s5p_aes_dev *dev, struct scatterlist *sg)
 {
SSS_WRITE(dev, FCBRDMAS, sg_dma_address(sg));
@@ -677,6 +684,7 @@ static struct platform_driver s5p_aes_crypto = {
.driver = {
.owner  = THIS_MODULE,
.name   = "s5p-secss",
+   .of_match_table = s5p_sss_dt_match,
},
 };
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/9 v5] crypto:s5p-sss: Add support for SSS module on Exynos

2014-01-29 Thread Naveen Krishna Chatradhi
This patch adds new compatible and variant struct to support the SSS
module on Exynos4 (Exynos4210), Exynos5 (Exynos5420 and Exynos5250)
for which
1. AES register are at an offset of 0x200 and
2. hash interrupt is not available

Signed-off-by: Naveen Krishna Ch 
CC: Herbert Xu 
CC: David S. Miller 
CC: Vladimir Zapolskiy 
TO: 
CC: 
---
Changes since v4:
Fix rebase error because of the patch 2/9

 .../devicetree/bindings/crypto/samsung-sss.txt |   21 +++-
 drivers/crypto/s5p-sss.c   |  107 +++-
 2 files changed, 103 insertions(+), 25 deletions(-)

diff --git a/Documentation/devicetree/bindings/crypto/samsung-sss.txt 
b/Documentation/devicetree/bindings/crypto/samsung-sss.txt
index d193084..ca578d3 100644
--- a/Documentation/devicetree/bindings/crypto/samsung-sss.txt
+++ b/Documentation/devicetree/bindings/crypto/samsung-sss.txt
@@ -8,17 +8,36 @@ The SSS module in S5PV210 SoC supports the following:
 -- SHA-1/SHA-256/MD5/HMAC (SHA-1/SHA-256/MD5)/PRNG
 -- PRNG: Pseudo Random Number Generator
 
+The SSS module in Exynos4 (Exynos4210) and
+Exynos5 (Exynos5420 and Exynos5250) SoCs
+supports the following also:
+-- ARCFOUR (ARC4)
+-- True Random Number Generator (TRNG)
+-- Secure Key Manager
+
 Required properties:
 
 - compatible : Should contain entries for this and backward compatible
   SSS versions:
   - "samsung,s5pv210-secss" for S5PV210 SoC.
+  - "samsung,exynos4210-secss" for Exynos4210, Exynos4212, Exynos4412, 
Exynos5250,
+   Exynos5260 and Exynos5420 SoCs.
 - reg : Offset and length of the register set for the module
 - interrupts : the interrupt-specifier for the SSS module.
Two interrupts "feed control and hash" in case of S5PV210
   Eg : interrupts = <0 feed-control 0> <0 hash 0>;
+   -- One interrupts "feed control" in case of
+  "samsung,exynos4210-secss".
 - clocks : list of clock phandle and specifier pairs for all clocks  listed in
clock-names property.
 - clock-names : list of device clock input names; should contain one entry
"secss".
-
+Example:
+   /* SSS_VER_5 */
+   sss@1083 {
+   compatible = "samsung,exynos4210-secss";
+   reg = <0x1083 0x1>;
+   interrupts = <0 112 0>;
+   clocks = <&clock 471>;
+   clock-names = "secss";
+   };
diff --git a/drivers/crypto/s5p-sss.c b/drivers/crypto/s5p-sss.c
index 73c8b38..da1c8943 100644
--- a/drivers/crypto/s5p-sss.c
+++ b/drivers/crypto/s5p-sss.c
@@ -106,7 +106,7 @@
 #define SSS_REG_FCPKDMAO0x005C
 
 /* AES registers */
-#define SSS_REG_AES_CONTROL 0x4000
+#define SSS_REG_AES_CONTROL0x00
 #define SSS_AES_BYTESWAP_DI _BIT(11)
 #define SSS_AES_BYTESWAP_DO _BIT(10)
 #define SSS_AES_BYTESWAP_IV _BIT(9)
@@ -122,21 +122,25 @@
 #define SSS_AES_CHAIN_MODE_CTR  _SBF(1, 0x02)
 #define SSS_AES_MODE_DECRYPT_BIT(0)
 
-#define SSS_REG_AES_STATUS  0x4004
+#define SSS_REG_AES_STATUS 0x04
 #define SSS_AES_BUSY_BIT(2)
 #define SSS_AES_INPUT_READY _BIT(1)
 #define SSS_AES_OUTPUT_READY_BIT(0)
 
-#define SSS_REG_AES_IN_DATA(s)  (0x4010 + (s << 2))
-#define SSS_REG_AES_OUT_DATA(s) (0x4020 + (s << 2))
-#define SSS_REG_AES_IV_DATA(s)  (0x4030 + (s << 2))
-#define SSS_REG_AES_CNT_DATA(s) (0x4040 + (s << 2))
-#define SSS_REG_AES_KEY_DATA(s) (0x4080 + (s << 2))
+#define SSS_REG_AES_IN_DATA(s) (0x10 + (s << 2))
+#define SSS_REG_AES_OUT_DATA(s)(0x20 + (s << 2))
+#define SSS_REG_AES_IV_DATA(s) (0x30 + (s << 2))
+#define SSS_REG_AES_CNT_DATA(s)(0x40 + (s << 2))
+#define SSS_REG_AES_KEY_DATA(s)(0x80 + (s << 2))
 
 #define SSS_REG(dev, reg)   ((dev)->ioaddr + (SSS_REG_##reg))
 #define SSS_READ(dev, reg)  __raw_readl(SSS_REG(dev, reg))
 #define SSS_WRITE(dev, reg, val)__raw_writel((val), SSS_REG(dev, reg))
 
+#define SSS_AES_REG(dev, reg)   ((dev)->aes_ioaddr + SSS_REG_##reg)
+#define SSS_AES_WRITE(dev, reg, val)__raw_writel((val), \
+   SSS_AES_REG(dev, reg))
+
 /* HW engine modes */
 #define FLAGS_AES_DECRYPT   _BIT(0)
 #define FLAGS_AES_MODE_MASK _SBF(1, 0x03)
@@ -146,6 +150,20 @@
 #define AES_KEY_LEN 16
 #define CRYPTO_QUEUE_LEN1
 
+/**
+ * struct samsung_aes_variant - platform specific SSS driver data
+ * @has_hash_irq: true if SSS module uses hash interrupt, false otherwise
+ * @aes_offset: AES register offset from SSS module's base.
+ *
+ * Specifies platform specific configuration of SSS module.
+ * Note: A structure for driver specific platform data is used for future
+ * expansion of its usage.
+ */
+struct samsung_aes_variant {
+   boolha

[PATCH v5 00/23]

2014-01-29 Thread Jean-Francois Moine
This patch set contains various extensions to the tda998x driver:

- simplify the i2c read/write
- code cleanup and fix some small errors
- use global constants
- don't read write-only registers
- add DT support
- use IRQ for connection status and EDID read

- v5
- remarks from Russell King
- free the IRQ on encoder destroy (patch 14)
- fix bad comment (patch 23)
- removal of 'set the video mode from the adjusted value'
which was breaking tilcdc (Darren Etheridge)
- use the IRQ trigger type from platform/DT (patch 14)

- v4
- remarks from Russell King (thank you, Russell)
- more comments about the patches
- remove 'fix a NULL pointer dereference'
- get the IRQ number from the i2c client
- remove 'get a better status of the connection'
- split the previous 'fix the ENABLE_SPACE register'
- add asounddef.h variables in 'change the frequence in the audio 
channel'
- add 'always enable EDID read IRQ'
- remove audio changes which will be in a next patch set about
  information exchanges with the audio subsystem
- v3
- remarks from Russell King
- more comments about the patches
- change variable name instead of copy (patch 7)
- add 'fix bad value in the AIF' (patch 8)
- add 'fix a NULL pointer dereference' (patch 13)
- add 'add DT documentation' (patch 16)
- remove 'use the tda998x video format when cea mode'
- remove 'change the video quantization
- remove 'fix the value of the TBG_CNTRL_1 register'
- remove 'tda998x: move the TBG_CNTRL_0 register setting'
- change fields of the register AIP_CLKSEL (patch 19)
- remove 'adjust the audio CTS to the mode clock'
- don't put a comment between field definition (patch 23)
- some more remarks may be found in the patches 10, 14, 15
- removal of the tda codec interface which will be the subject
of an other patch series
- v2
- decompose patches with different topics
- fix some bad i2c register values
- add audio codec interface

Jean-Francois Moine (23):
  drm/i2c: tda998x: simplify the i2c read/write functions
  drm/i2c: tda998x: check more I/O errors
  drm/i2c: tda998x: code cleanup
  drm/i2c: tda998x: change probe message origin
  drm/i2c: tda998x: don't freeze the system at audio startup time
  drm/i2c: tda998x: force the page register at startup time
  drm/i2c: tda998x: fix bad value in the AIF
  drm/i2c: tda998x: use HDMI constants
  drm/i2c: tda998x: don't read write-only registers
  drm/i2c: tda998x: free the CEC device on encoder_destroy
  drm/i2c: tda998x: check the CEC device creation
  drm/i2c: tda998x: add DT support
  drm/i2c: tda998x: always enable EDID read IRQ
  drm/i2c: tda998x: use irq for connection status and EDID read
  drm/i2c: tda998x: add DT documentation
  drm/i2c: tda998x: fix the ENABLE_SPACE register
  drm/i2c: tda998x: set the PLL division factor in range 0..3
  drm/i2c: tda998x: make the audio code more readable
  drm/i2c: tda998x: remove the unused variable ca_i2s
  drm/i2c: tda998x: add the active aspect in HDMI AVI frame
  drm/i2c: tda998x: change the frequence in the audio channel
  drm/i2c: tda998x: code optimization
  drm/i2c: tda998x: adjust the audio clock divider for S/PDIF

 .../devicetree/bindings/drm/i2c/tda998x.txt|  27 +
 drivers/gpu/drm/i2c/tda998x_drv.c  | 609 +
 2 files changed, 416 insertions(+), 220 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/drm/i2c/tda998x.txt

-- 
1.9.rc1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v5 01/23] drm/i2c: tda998x: simplify the i2c read/write functions

2014-01-29 Thread Jean-Francois Moine
This patch simplifies the i2c read/write functions and permits them to
be easily called in more contexts.

Acked-by: Russell King 
Tested-by: Russell King 
Signed-off-by: Jean-Francois Moine 
---
 drivers/gpu/drm/i2c/tda998x_drv.c | 322 +++---
 1 file changed, 162 insertions(+), 160 deletions(-)

diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c 
b/drivers/gpu/drm/i2c/tda998x_drv.c
index 400b0c4..26dd299 100644
--- a/drivers/gpu/drm/i2c/tda998x_drv.c
+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
@@ -30,6 +30,7 @@
 
 struct tda998x_priv {
struct i2c_client *cec;
+   struct i2c_client *hdmi;
uint16_t rev;
uint8_t current_page;
int dpms;
@@ -328,9 +329,9 @@ struct tda998x_priv {
 #define TDA19988  0x0301
 
 static void
-cec_write(struct drm_encoder *encoder, uint16_t addr, uint8_t val)
+cec_write(struct tda998x_priv *priv, uint16_t addr, uint8_t val)
 {
-   struct i2c_client *client = to_tda998x_priv(encoder)->cec;
+   struct i2c_client *client = priv->cec;
uint8_t buf[] = {addr, val};
int ret;
 
@@ -340,9 +341,9 @@ cec_write(struct drm_encoder *encoder, uint16_t addr, 
uint8_t val)
 }
 
 static uint8_t
-cec_read(struct drm_encoder *encoder, uint8_t addr)
+cec_read(struct tda998x_priv *priv, uint8_t addr)
 {
-   struct i2c_client *client = to_tda998x_priv(encoder)->cec;
+   struct i2c_client *client = priv->cec;
uint8_t val;
int ret;
 
@@ -362,12 +363,10 @@ fail:
 }
 
 static void
-set_page(struct drm_encoder *encoder, uint16_t reg)
+set_page(struct tda998x_priv *priv, uint16_t reg)
 {
-   struct tda998x_priv *priv = to_tda998x_priv(encoder);
-
if (REG2PAGE(reg) != priv->current_page) {
-   struct i2c_client *client = drm_i2c_encoder_get_client(encoder);
+   struct i2c_client *client = priv->hdmi;
uint8_t buf[] = {
REG_CURPAGE, REG2PAGE(reg)
};
@@ -380,13 +379,13 @@ set_page(struct drm_encoder *encoder, uint16_t reg)
 }
 
 static int
-reg_read_range(struct drm_encoder *encoder, uint16_t reg, char *buf, int cnt)
+reg_read_range(struct tda998x_priv *priv, uint16_t reg, char *buf, int cnt)
 {
-   struct i2c_client *client = drm_i2c_encoder_get_client(encoder);
+   struct i2c_client *client = priv->hdmi;
uint8_t addr = REG2ADDR(reg);
int ret;
 
-   set_page(encoder, reg);
+   set_page(priv, reg);
 
ret = i2c_master_send(client, &addr, sizeof(addr));
if (ret < 0)
@@ -404,16 +403,16 @@ fail:
 }
 
 static void
-reg_write_range(struct drm_encoder *encoder, uint16_t reg, uint8_t *p, int cnt)
+reg_write_range(struct tda998x_priv *priv, uint16_t reg, uint8_t *p, int cnt)
 {
-   struct i2c_client *client = drm_i2c_encoder_get_client(encoder);
+   struct i2c_client *client = priv->hdmi;
uint8_t buf[cnt+1];
int ret;
 
buf[0] = REG2ADDR(reg);
memcpy(&buf[1], p, cnt);
 
-   set_page(encoder, reg);
+   set_page(priv, reg);
 
ret = i2c_master_send(client, buf, cnt + 1);
if (ret < 0)
@@ -421,21 +420,21 @@ reg_write_range(struct drm_encoder *encoder, uint16_t 
reg, uint8_t *p, int cnt)
 }
 
 static uint8_t
-reg_read(struct drm_encoder *encoder, uint16_t reg)
+reg_read(struct tda998x_priv *priv, uint16_t reg)
 {
uint8_t val = 0;
-   reg_read_range(encoder, reg, &val, sizeof(val));
+   reg_read_range(priv, reg, &val, sizeof(val));
return val;
 }
 
 static void
-reg_write(struct drm_encoder *encoder, uint16_t reg, uint8_t val)
+reg_write(struct tda998x_priv *priv, uint16_t reg, uint8_t val)
 {
-   struct i2c_client *client = drm_i2c_encoder_get_client(encoder);
+   struct i2c_client *client = priv->hdmi;
uint8_t buf[] = {REG2ADDR(reg), val};
int ret;
 
-   set_page(encoder, reg);
+   set_page(priv, reg);
 
ret = i2c_master_send(client, buf, ARRAY_SIZE(buf));
if (ret < 0)
@@ -443,13 +442,13 @@ reg_write(struct drm_encoder *encoder, uint16_t reg, 
uint8_t val)
 }
 
 static void
-reg_write16(struct drm_encoder *encoder, uint16_t reg, uint16_t val)
+reg_write16(struct tda998x_priv *priv, uint16_t reg, uint16_t val)
 {
-   struct i2c_client *client = drm_i2c_encoder_get_client(encoder);
+   struct i2c_client *client = priv->hdmi;
uint8_t buf[] = {REG2ADDR(reg), val >> 8, val};
int ret;
 
-   set_page(encoder, reg);
+   set_page(priv, reg);
 
ret = i2c_master_send(client, buf, ARRAY_SIZE(buf));
if (ret < 0)
@@ -457,47 +456,47 @@ reg_write16(struct drm_encoder *encoder, uint16_t reg, 
uint16_t val)
 }
 
 static void
-reg_set(struct drm_encoder *encoder, uint16_t reg, uint8_t val)
+reg_set(struct tda998x_priv *priv, uint16_t reg, uint8_t val)
 {
-   reg_write(encoder, reg, reg_read(encoder, reg) | val);
+   reg_write(priv, reg, reg_read(priv, reg) | val);
 }
 
 static void
-reg_clear(s

[PATCH 4/9 v5] crypto:s5p-sss: Kconfig: Let Exynos SoCs select SSS driver

2014-01-29 Thread Naveen Krishna Chatradhi
From: Naveen Krishna Ch 

This patch modifies Kconfig such that ARCH_EXYNOS SoCs
which includes (Exynos4210, Exynos5250 and Exynos5420)
can also select Samsung SSS(Security SubSystem) driver.

Signed-off-by: Naveen Krishna Ch 
CC: Herbert Xu 
CC: David S. Miller 
CC: Vladimir Zapolskiy 
TO: 
CC: 
---
Changes since v4:
none
Changes since v3:
Modified description to use "Exynos" instead of individual SoC name
 drivers/crypto/Kconfig |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig
index f4fd837..cb38863 100644
--- a/drivers/crypto/Kconfig
+++ b/drivers/crypto/Kconfig
@@ -300,14 +300,14 @@ config CRYPTO_DEV_DCP
  capabilities of the DCP co-processor
 
 config CRYPTO_DEV_S5P
-   tristate "Support for Samsung S5PV210 crypto accelerator"
-   depends on ARCH_S5PV210
+   tristate "Support for Samsung S5PV210/Exynos crypto accelerator"
+   depends on ARCH_S5PV210 || ARCH_EXYNOS
select CRYPTO_AES
select CRYPTO_ALGAPI
select CRYPTO_BLKCIPHER
help
  This option allows you to have support for S5P crypto acceleration.
- Select this to offload Samsung S5PV210 or S5PC110 from AES
+ Select this to offload Samsung S5PV210 or S5PC110, Exynos from AES
  algorithms execution.
 
 config CRYPTO_DEV_TEGRA_AES
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v5 06/23] drm/i2c: tda998x: force the page register at startup time

2014-01-29 Thread Jean-Francois Moine
This patch forces the page register to be set on the first I/O operation.

Tested-by: Russell King 
Acked-by: Russell King 
Signed-off-by: Jean-Francois Moine 
---
 drivers/gpu/drm/i2c/tda998x_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c 
b/drivers/gpu/drm/i2c/tda998x_drv.c
index 96b5966..b688801 100644
--- a/drivers/gpu/drm/i2c/tda998x_drv.c
+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
@@ -1170,7 +1170,7 @@ tda998x_encoder_init(struct i2c_client *client,
priv->vip_cntrl_1 = VIP_CNTRL_1_SWAP_C(0) | VIP_CNTRL_1_SWAP_D(1);
priv->vip_cntrl_2 = VIP_CNTRL_2_SWAP_E(4) | VIP_CNTRL_2_SWAP_F(5);
 
-   priv->current_page = 0;
+   priv->current_page = 0xff;
priv->hdmi = client;
priv->cec = i2c_new_dummy(client->adapter, 0x34);
priv->dpms = DRM_MODE_DPMS_OFF;
-- 
1.9.rc1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v5 05/23] drm/i2c: tda998x: don't freeze the system at audio startup time

2014-01-29 Thread Jean-Francois Moine
This patch prevents the system to be freezed at audio startup time,
replacing mdelay by msleep.

Tested-by: Russell King 
Acked-by: Russell King 
Signed-off-by: Jean-Francois Moine 
---
 drivers/gpu/drm/i2c/tda998x_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c 
b/drivers/gpu/drm/i2c/tda998x_drv.c
index fbd7937..96b5966 100644
--- a/drivers/gpu/drm/i2c/tda998x_drv.c
+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
@@ -678,7 +678,7 @@ tda998x_configure_audio(struct tda998x_priv *priv,
reg_write_range(priv, REG_CH_STAT_B(0), buf, 4);
 
tda998x_audio_mute(priv, true);
-   mdelay(20);
+   msleep(20);
tda998x_audio_mute(priv, false);
 
/* Write the audio information packet */
-- 
1.9.rc1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v5 04/23] drm/i2c: tda998x: change probe message origin

2014-01-29 Thread Jean-Francois Moine
On probe, a message giving the TDA chip version seems to come from the
DRM driver:

armada-drm armada-510-drm: found TDA19988

This patch changes the originator of the message to the TDA driver:

tda998x 0-0070: found TDA19988

Acked-by: Russell King 
Tested-by: Russell King 
Signed-off-by: Jean-Francois Moine 
---
 drivers/gpu/drm/i2c/tda998x_drv.c | 19 ++-
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c 
b/drivers/gpu/drm/i2c/tda998x_drv.c
index 320b37f..fbd7937 100644
--- a/drivers/gpu/drm/i2c/tda998x_drv.c
+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
@@ -1195,12 +1195,21 @@ tda998x_encoder_init(struct i2c_client *client,
priv->rev &= ~0x30; /* not-hdcp and not-scalar bit */
 
switch (priv->rev) {
-   case TDA9989N2:  dev_info(dev->dev, "found TDA9989 n2");  break;
-   case TDA19989:   dev_info(dev->dev, "found TDA19989");break;
-   case TDA19989N2: dev_info(dev->dev, "found TDA19989 n2"); break;
-   case TDA19988:   dev_info(dev->dev, "found TDA19988");break;
+   case TDA9989N2:
+   dev_info(&client->dev, "found TDA9989 n2");
+   break;
+   case TDA19989:
+   dev_info(&client->dev, "found TDA19989");
+   break;
+   case TDA19989N2:
+   dev_info(&client->dev, "found TDA19989 n2");
+   break;
+   case TDA19988:
+   dev_info(&client->dev, "found TDA19988");
+   break;
default:
-   DBG("found unsupported device: %04x", priv->rev);
+   dev_err(&client->dev, "found unsupported device: %04x\n",
+   priv->rev);
goto fail;
}
 
-- 
1.9.rc1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v5 03/23] drm/i2c: tda998x: code cleanup

2014-01-29 Thread Jean-Francois Moine
This patch:
- replaces ARRAY_SIZE() by sizeof() when a number of bytes is needed,
- adds a linefeed in an error message and
- removes an useless variable setting.

Acked-by: Russell King 
Tested-by: Russell King 
Signed-off-by: Jean-Francois Moine 
---
 drivers/gpu/drm/i2c/tda998x_drv.c | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c 
b/drivers/gpu/drm/i2c/tda998x_drv.c
index 11f0607..320b37f 100644
--- a/drivers/gpu/drm/i2c/tda998x_drv.c
+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
@@ -335,7 +335,7 @@ cec_write(struct tda998x_priv *priv, uint16_t addr, uint8_t 
val)
uint8_t buf[] = {addr, val};
int ret;
 
-   ret = i2c_master_send(client, buf, ARRAY_SIZE(buf));
+   ret = i2c_master_send(client, buf, sizeof(buf));
if (ret < 0)
dev_err(&client->dev, "Error %d writing to cec:0x%x\n", ret, 
addr);
 }
@@ -372,7 +372,8 @@ set_page(struct tda998x_priv *priv, uint16_t reg)
};
int ret = i2c_master_send(client, buf, sizeof(buf));
if (ret < 0) {
-   dev_err(&client->dev, "Error %d writing to 
REG_CURPAGE\n", ret);
+   dev_err(&client->dev, "setpage %04x err %d\n",
+   reg, ret);
return ret;
}
 
@@ -449,7 +450,7 @@ reg_write(struct tda998x_priv *priv, uint16_t reg, uint8_t 
val)
if (ret < 0)
return;
 
-   ret = i2c_master_send(client, buf, ARRAY_SIZE(buf));
+   ret = i2c_master_send(client, buf, sizeof(buf));
if (ret < 0)
dev_err(&client->dev, "Error %d writing to 0x%x\n", ret, reg);
 }
@@ -465,7 +466,7 @@ reg_write16(struct tda998x_priv *priv, uint16_t reg, 
uint16_t val)
if (ret < 0)
return;
 
-   ret = i2c_master_send(client, buf, ARRAY_SIZE(buf));
+   ret = i2c_master_send(client, buf, sizeof(buf));
if (ret < 0)
dev_err(&client->dev, "Error %d writing to 0x%x\n", ret, reg);
 }
@@ -1006,7 +1007,7 @@ read_edid_block(struct drm_encoder *encoder, uint8_t 
*buf, int blk)
 
ret = reg_read_range(priv, REG_EDID_DATA_0, buf, EDID_LENGTH);
if (ret != EDID_LENGTH) {
-   dev_err(encoder->dev->dev, "failed to read edid block %d: %d",
+   dev_err(encoder->dev->dev, "failed to read edid block %d: %d\n",
blk, ret);
return ret;
}
@@ -1020,7 +1021,7 @@ static uint8_t *
 do_get_edid(struct drm_encoder *encoder)
 {
struct tda998x_priv *priv = to_tda998x_priv(encoder);
-   int j = 0, valid_extensions = 0;
+   int j, valid_extensions = 0;
uint8_t *block, *new;
bool print_bad_edid = drm_debug & DRM_UT_KMS;
 
-- 
1.9.rc1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v5 10/23] drm/i2c: tda998x: free the CEC device on encoder_destroy

2014-01-29 Thread Jean-Francois Moine
The cec i2c device is created in tda998x_encoder_init() when the DRM
driver starts.
This patch frees it when the DRM driver is unloaded.

Tested-by: Russell King 
Acked-by: Russell King 
Signed-off-by: Jean-Francois Moine 
---
 drivers/gpu/drm/i2c/tda998x_drv.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c 
b/drivers/gpu/drm/i2c/tda998x_drv.c
index d6d0e80..7d8bc22 100644
--- a/drivers/gpu/drm/i2c/tda998x_drv.c
+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
@@ -1124,6 +1124,8 @@ tda998x_encoder_destroy(struct drm_encoder *encoder)
 {
struct tda998x_priv *priv = to_tda998x_priv(encoder);
drm_i2c_encoder_destroy(encoder);
+   if (priv->cec)
+   i2c_unregister_device(priv->cec);
kfree(priv);
 }
 
-- 
1.9.rc1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v5 09/23] drm/i2c: tda998x: don't read write-only registers

2014-01-29 Thread Jean-Francois Moine
This patch takes care of the write-only registers of the tda998x.

The registers SOFTRESET, TBG_CNTRL_0 and TBG_CNTRL_1 have all bits
cleared after reset, so, they may be fully re-written.

The register MAT_CONTRL is set to
MAT_CONTRL_MAT_BP | MAT_CONTRL_MAT_SC(1)
after reset, so, it may be fully set again to this value.

Signed-off-by: Jean-Francois Moine 
---
 drivers/gpu/drm/i2c/tda998x_drv.c | 46 ---
 1 file changed, 24 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c 
b/drivers/gpu/drm/i2c/tda998x_drv.c
index bb0c6ac..d6d0e80 100644
--- a/drivers/gpu/drm/i2c/tda998x_drv.c
+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
@@ -495,9 +495,9 @@ static void
 tda998x_reset(struct tda998x_priv *priv)
 {
/* reset audio and i2c master: */
-   reg_set(priv, REG_SOFTRESET, SOFTRESET_AUDIO | SOFTRESET_I2C_MASTER);
+   reg_write(priv, REG_SOFTRESET, SOFTRESET_AUDIO | SOFTRESET_I2C_MASTER);
msleep(50);
-   reg_clear(priv, REG_SOFTRESET, SOFTRESET_AUDIO | SOFTRESET_I2C_MASTER);
+   reg_write(priv, REG_SOFTRESET, 0);
msleep(50);
 
/* reset transmitter: */
@@ -852,7 +852,7 @@ tda998x_encoder_mode_set(struct drm_encoder *encoder,
reg_set(priv, REG_AIP_CNTRL_0, AIP_CNTRL_0_RST_FIFO);
 
/* set HDMI HDCP mode off: */
-   reg_set(priv, REG_TBG_CNTRL_1, TBG_CNTRL_1_DWIN_DIS);
+   reg_write(priv, REG_TBG_CNTRL_1, TBG_CNTRL_1_DWIN_DIS);
reg_clear(priv, REG_TX33, TX33_HDMI);
reg_write(priv, REG_ENC_CNTRL, ENC_CNTRL_CTL_CODE(0));
 
@@ -879,38 +879,28 @@ tda998x_encoder_mode_set(struct drm_encoder *encoder,
PLL_SERIAL_2_SRL_PR(rep));
 
/* set color matrix bypass flag: */
-   reg_set(priv, REG_MAT_CONTRL, MAT_CONTRL_MAT_BP);
+   reg_write(priv, REG_MAT_CONTRL, MAT_CONTRL_MAT_BP |
+   MAT_CONTRL_MAT_SC(1));
 
/* set BIAS tmds value: */
reg_write(priv, REG_ANA_GENERAL, 0x09);
 
-   reg_clear(priv, REG_TBG_CNTRL_0, TBG_CNTRL_0_SYNC_MTHD);
+   reg_write(priv, REG_TBG_CNTRL_0, 0);
 
/*
 * Sync on rising HSYNC/VSYNC
 */
-   reg_write(priv, REG_VIP_CNTRL_3, 0);
-   reg_set(priv, REG_VIP_CNTRL_3, VIP_CNTRL_3_SYNC_HS);
+   reg = VIP_CNTRL_3_SYNC_HS;
 
/*
 * TDA19988 requires high-active sync at input stage,
 * so invert low-active sync provided by master encoder here
 */
if (mode->flags & DRM_MODE_FLAG_NHSYNC)
-   reg_set(priv, REG_VIP_CNTRL_3, VIP_CNTRL_3_H_TGL);
+   reg |= VIP_CNTRL_3_H_TGL;
if (mode->flags & DRM_MODE_FLAG_NVSYNC)
-   reg_set(priv, REG_VIP_CNTRL_3, VIP_CNTRL_3_V_TGL);
-
-   /*
-* Always generate sync polarity relative to input sync and
-* revert input stage toggled sync at output stage
-*/
-   reg = TBG_CNTRL_1_TGL_EN;
-   if (mode->flags & DRM_MODE_FLAG_NHSYNC)
-   reg |= TBG_CNTRL_1_H_TGL;
-   if (mode->flags & DRM_MODE_FLAG_NVSYNC)
-   reg |= TBG_CNTRL_1_V_TGL;
-   reg_write(priv, REG_TBG_CNTRL_1, reg);
+   reg |= VIP_CNTRL_3_V_TGL;
+   reg_write(priv, REG_VIP_CNTRL_3, reg);
 
reg_write(priv, REG_VIDFORMAT, 0x00);
reg_write16(priv, REG_REFPIX_MSB, ref_pix);
@@ -939,13 +929,25 @@ tda998x_encoder_mode_set(struct drm_encoder *encoder,
reg_write(priv, REG_ENABLE_SPACE, 0x01);
}
 
+   /*
+* Always generate sync polarity relative to input sync and
+* revert input stage toggled sync at output stage
+*/
+   reg = TBG_CNTRL_1_DWIN_DIS | TBG_CNTRL_1_TGL_EN;
+   if (mode->flags & DRM_MODE_FLAG_NHSYNC)
+   reg |= TBG_CNTRL_1_H_TGL;
+   if (mode->flags & DRM_MODE_FLAG_NVSYNC)
+   reg |= TBG_CNTRL_1_V_TGL;
+   reg_write(priv, REG_TBG_CNTRL_1, reg);
+
/* must be last register set: */
-   reg_clear(priv, REG_TBG_CNTRL_0, TBG_CNTRL_0_SYNC_ONCE);
+   reg_write(priv, REG_TBG_CNTRL_0, 0);
 
/* Only setup the info frames if the sink is HDMI */
if (priv->is_hdmi_sink) {
/* We need to turn HDMI HDCP stuff on to get audio through */
-   reg_clear(priv, REG_TBG_CNTRL_1, TBG_CNTRL_1_DWIN_DIS);
+   reg &= ~TBG_CNTRL_1_DWIN_DIS;
+   reg_write(priv, REG_TBG_CNTRL_1, reg);
reg_write(priv, REG_ENC_CNTRL, ENC_CNTRL_CTL_CODE(1));
reg_set(priv, REG_TX33, TX33_HDMI);
 
-- 
1.9.rc1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v5 07/23] drm/i2c: tda998x: fix bad value in the AIF

2014-01-29 Thread Jean-Francois Moine
The AIF has an uninitialized byte. This patch clears the whole buffer
before filling it.

Tested-by: Russell King 
Acked-by: Russell King 
Signed-off-by: Jean-Francois Moine 
---
 drivers/gpu/drm/i2c/tda998x_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c 
b/drivers/gpu/drm/i2c/tda998x_drv.c
index b688801..16f2473 100644
--- a/drivers/gpu/drm/i2c/tda998x_drv.c
+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
@@ -551,10 +551,10 @@ tda998x_write_aif(struct tda998x_priv *priv, struct 
tda998x_encoder_params *p)
 {
uint8_t buf[PB(5) + 1];
 
+   memset(buf, 0, sizeof(buf));
buf[HB(0)] = 0x84;
buf[HB(1)] = 0x01;
buf[HB(2)] = 10;
-   buf[PB(0)] = 0;
buf[PB(1)] = p->audio_frame[1] & 0x07; /* CC */
buf[PB(2)] = p->audio_frame[2] & 0x1c; /* SF */
buf[PB(4)] = p->audio_frame[4];
-- 
1.9.rc1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v5 08/23] drm/i2c: tda998x: use HDMI constants

2014-01-29 Thread Jean-Francois Moine
This patch replaces hard coded values by hdmi constants.

Tested-by: Russell King 
Acked-by: Russell King 
Signed-off-by: Jean-Francois Moine 
---
 drivers/gpu/drm/i2c/tda998x_drv.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c 
b/drivers/gpu/drm/i2c/tda998x_drv.c
index 16f2473..bb0c6ac 100644
--- a/drivers/gpu/drm/i2c/tda998x_drv.c
+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
@@ -549,12 +549,12 @@ tda998x_write_if(struct tda998x_priv *priv, uint8_t bit, 
uint16_t addr,
 static void
 tda998x_write_aif(struct tda998x_priv *priv, struct tda998x_encoder_params *p)
 {
-   uint8_t buf[PB(5) + 1];
+   u8 buf[PB(HDMI_AUDIO_INFOFRAME_SIZE) + 1];
 
memset(buf, 0, sizeof(buf));
-   buf[HB(0)] = 0x84;
+   buf[HB(0)] = HDMI_INFOFRAME_TYPE_AUDIO;
buf[HB(1)] = 0x01;
-   buf[HB(2)] = 10;
+   buf[HB(2)] = HDMI_AUDIO_INFOFRAME_SIZE;
buf[PB(1)] = p->audio_frame[1] & 0x07; /* CC */
buf[PB(2)] = p->audio_frame[2] & 0x1c; /* SF */
buf[PB(4)] = p->audio_frame[4];
@@ -567,12 +567,12 @@ tda998x_write_aif(struct tda998x_priv *priv, struct 
tda998x_encoder_params *p)
 static void
 tda998x_write_avi(struct tda998x_priv *priv, struct drm_display_mode *mode)
 {
-   uint8_t buf[PB(13) + 1];
+   u8 buf[PB(HDMI_AVI_INFOFRAME_SIZE) + 1];
 
memset(buf, 0, sizeof(buf));
-   buf[HB(0)] = 0x82;
+   buf[HB(0)] = HDMI_INFOFRAME_TYPE_AVI;
buf[HB(1)] = 0x02;
-   buf[HB(2)] = 13;
+   buf[HB(2)] = HDMI_AVI_INFOFRAME_SIZE;
buf[PB(1)] = HDMI_SCAN_MODE_UNDERSCAN;
buf[PB(3)] = HDMI_QUANTIZATION_RANGE_FULL << 2;
buf[PB(4)] = drm_match_cea_mode(mode);
-- 
1.9.rc1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v5 15/23] drm/i2c: tda998x: add DT documentation

2014-01-29 Thread Jean-Francois Moine
Signed-off-by: Jean-Francois Moine 
---
 .../devicetree/bindings/drm/i2c/tda998x.txt| 27 ++
 1 file changed, 27 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/drm/i2c/tda998x.txt

diff --git a/Documentation/devicetree/bindings/drm/i2c/tda998x.txt 
b/Documentation/devicetree/bindings/drm/i2c/tda998x.txt
new file mode 100644
index 000..d7df01c
--- /dev/null
+++ b/Documentation/devicetree/bindings/drm/i2c/tda998x.txt
@@ -0,0 +1,27 @@
+Device-Tree bindings for the NXP TDA998x HDMI transmitter
+
+Required properties;
+  - compatible: must be "nxp,tda998x"
+
+Optional properties:
+  - interrupts: interrupt number and trigger type
+   default: polling
+
+  - pinctrl-0: pin control group to be used for
+   screen plug/unplug interrupt.
+
+  - pinctrl-names: must contain a "default" entry.
+
+  - video-ports: 24 bits value which defines how the video controller
+   output is wired to the TDA998x input - default: <0x230145>
+
+Example:
+
+   tda998x: hdmi-encoder {
+   compatible = "nxp,tda998x";
+   reg = <0x70>;
+   interrupt-parent = <&gpio0>;
+   interrupts = <27 2>;/* falling edge */
+   pinctrl-0 = <&pmx_camera>;
+   pinctrl-names = "default";
+   };
-- 
1.9.rc1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v5 13/23] drm/i2c: tda998x: always enable EDID read IRQ

2014-01-29 Thread Jean-Francois Moine
There is no need to enable/disable EDID read IRQ at each EDID block
read. This patch enables the IRQ at init time.

Signed-off-by: Jean-Francois Moine 
---
 drivers/gpu/drm/i2c/tda998x_drv.c | 8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c 
b/drivers/gpu/drm/i2c/tda998x_drv.c
index d4074e0..5b0b6ca 100644
--- a/drivers/gpu/drm/i2c/tda998x_drv.c
+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
@@ -977,9 +977,6 @@ read_edid_block(struct drm_encoder *encoder, uint8_t *buf, 
int blk)
uint8_t offset, segptr;
int ret, i;
 
-   /* enable EDID read irq: */
-   reg_set(priv, REG_INT_FLAGS_2, INT_FLAGS_2_EDID_BLK_RD);
-
offset = (blk & 1) ? 128 : 0;
segptr = blk / 2;
 
@@ -1014,8 +1011,6 @@ read_edid_block(struct drm_encoder *encoder, uint8_t 
*buf, int blk)
return ret;
}
 
-   reg_clear(priv, REG_INT_FLAGS_2, INT_FLAGS_2_EDID_BLK_RD);
-
return 0;
 }
 
@@ -1234,6 +1229,9 @@ tda998x_encoder_init(struct i2c_client *client,
cec_write(priv, REG_CEC_FRO_IM_CLK_CTRL,
CEC_FRO_IM_CLK_CTRL_GHOST_DIS | 
CEC_FRO_IM_CLK_CTRL_IMCLK_SEL);
 
+   /* enable EDID read irq: */
+   reg_set(priv, REG_INT_FLAGS_2, INT_FLAGS_2_EDID_BLK_RD);
+
if (!np)
return 0;   /* non-DT */
 
-- 
1.9.rc1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v5 14/23] drm/i2c: tda998x: use irq for connection status and EDID read

2014-01-29 Thread Jean-Francois Moine
This patch adds the optional treatment of the tda998x IRQ.

The interrupt function is used to know the display connection status
without polling and to speedup reading the EDID.

The IRQ number and trigger type are defined in the i2c client either
by platform data or in the DT.

Signed-off-by: Jean-Francois Moine 
---
 drivers/gpu/drm/i2c/tda998x_drv.c | 113 +++---
 1 file changed, 104 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c 
b/drivers/gpu/drm/i2c/tda998x_drv.c
index 5b0b6ca..7fab61a 100644
--- a/drivers/gpu/drm/i2c/tda998x_drv.c
+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
@@ -19,6 +19,7 @@
 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -39,6 +40,10 @@ struct tda998x_priv {
u8 vip_cntrl_1;
u8 vip_cntrl_2;
struct tda998x_encoder_params params;
+
+   wait_queue_head_t wq_edid;
+   volatile int wq_edid_wait;
+   struct drm_encoder *encoder;
 };
 
 #define to_tda998x_priv(x)  ((struct tda998x_priv 
*)to_encoder_slave(x)->slave_priv)
@@ -305,11 +310,16 @@ struct tda998x_priv {
 
 /* CEC registers: (not paged)
  */
+#define REG_CEC_INTSTATUS0xee/* read */
+# define CEC_INTSTATUS_CEC   (1 << 0)
+# define CEC_INTSTATUS_HDMI  (1 << 1)
 #define REG_CEC_FRO_IM_CLK_CTRL   0xfb/* read/write */
 # define CEC_FRO_IM_CLK_CTRL_GHOST_DIS (1 << 7)
 # define CEC_FRO_IM_CLK_CTRL_ENA_OTP   (1 << 6)
 # define CEC_FRO_IM_CLK_CTRL_IMCLK_SEL (1 << 1)
 # define CEC_FRO_IM_CLK_CTRL_FRO_DIV   (1 << 0)
+#define REG_CEC_RXSHPDINTENA 0xfc/* read/write */
+#define REG_CEC_RXSHPDINT0xfd/* read */
 #define REG_CEC_RXSHPDLEV 0xfe/* read */
 # define CEC_RXSHPDLEV_RXSENS (1 << 0)
 # define CEC_RXSHPDLEV_HPD(1 << 1)
@@ -523,6 +533,35 @@ tda998x_reset(struct tda998x_priv *priv)
reg_write(priv, REG_MUX_VP_VIP_OUT, 0x24);
 }
 
+/*
+ * only 2 interrupts may occur: screen plug/unplug and EDID read
+ */
+static irqreturn_t tda998x_irq_thread(int irq, void *data)
+{
+   struct tda998x_priv *priv = data;
+   u8 sta, cec, lvl, flag0, flag1, flag2;
+
+   if (!priv)
+   return IRQ_HANDLED;
+   sta = cec_read(priv, REG_CEC_INTSTATUS);
+   cec = cec_read(priv, REG_CEC_RXSHPDINT);
+   lvl = cec_read(priv, REG_CEC_RXSHPDLEV);
+   flag0 = reg_read(priv, REG_INT_FLAGS_0);
+   flag1 = reg_read(priv, REG_INT_FLAGS_1);
+   flag2 = reg_read(priv, REG_INT_FLAGS_2);
+   DRM_DEBUG_DRIVER(
+   "tda irq sta %02x cec %02x lvl %02x f0 %02x f1 %02x f2 %02x\n",
+   sta, cec, lvl, flag0, flag1, flag2);
+   if ((flag2 & INT_FLAGS_2_EDID_BLK_RD) && priv->wq_edid_wait) {
+   priv->wq_edid_wait = 0;
+   wake_up(&priv->wq_edid);
+   } else if (cec != 0) {  /* HPD change */
+   if (priv->encoder && priv->encoder->dev)
+   drm_helper_hpd_irq_event(priv->encoder->dev);
+   }
+   return IRQ_HANDLED;
+}
+
 static uint8_t tda998x_cksum(uint8_t *buf, size_t bytes)
 {
uint8_t sum = 0;
@@ -986,23 +1025,36 @@ read_edid_block(struct drm_encoder *encoder, uint8_t 
*buf, int blk)
reg_write(priv, REG_DDC_SEGM, segptr);
 
/* enable reading EDID: */
+   priv->wq_edid_wait = 1;
reg_write(priv, REG_EDID_CTRL, 0x1);
 
/* flag must be cleared by sw: */
reg_write(priv, REG_EDID_CTRL, 0x0);
 
/* wait for block read to complete: */
-   for (i = 100; i > 0; i--) {
-   ret = reg_read(priv, REG_INT_FLAGS_2);
-   if (ret < 0)
-   return ret;
-   if (ret & INT_FLAGS_2_EDID_BLK_RD)
-   break;
-   msleep(1);
+   if (priv->hdmi->irq) {
+   i = wait_event_timeout(priv->wq_edid,
+   !priv->wq_edid_wait,
+   msecs_to_jiffies(100));
+   if (i < 0) {
+   dev_err(encoder->dev->dev, "read edid wait err %d\n", 
i);
+   return i;
+   }
+   } else {
+   for (i = 10; i > 0; i--) {
+   msleep(10);
+   ret = reg_read(priv, REG_INT_FLAGS_2);
+   if (ret < 0)
+   return ret;
+   if (ret & INT_FLAGS_2_EDID_BLK_RD)
+   break;
+   }
}
 
-   if (i == 0)
+   if (i == 0) {
+   dev_err(encoder->dev->dev, "read edid timeout\n");
return -ETIMEDOUT;
+   }
 
ret = reg_read_range(priv, REG_EDID_DATA_0, buf, EDID_LENGTH);
if (ret != EDID_LENGTH) {
@@ -1100,7 +1152,13 @@ static int
 tda998x_encoder_create_resources(struct drm_encoder *encoder,
struct drm_connector *connector)

[PATCH v5 16/23] drm/i2c: tda998x: fix the ENABLE_SPACE register

2014-01-29 Thread Jean-Francois Moine
This patch fixes the ENABLE_SPACE register, the value of which was
inverted.

Signed-off-by: Jean-Francois Moine 
---
 drivers/gpu/drm/i2c/tda998x_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c 
b/drivers/gpu/drm/i2c/tda998x_drv.c
index 7fab61a..36e95b2 100644
--- a/drivers/gpu/drm/i2c/tda998x_drv.c
+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
@@ -965,7 +965,7 @@ tda998x_encoder_mode_set(struct drm_encoder *encoder,
 
if (priv->rev == TDA19988) {
/* let incoming pixels fill the active space (if any) */
-   reg_write(priv, REG_ENABLE_SPACE, 0x01);
+   reg_write(priv, REG_ENABLE_SPACE, 0x00);
}
 
/*
-- 
1.9.rc1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2] HID: i2c-hid: add runtime PM support

2014-01-29 Thread Mika Westerberg
This patch adds runtime PM support for the HID over I2C driver. When the
i2c-hid device is first opened we power it on and on the last close we
power it off. This is actually what the driver is already doing but in
addition it allows subsystems, like ACPI power domain to power off the
device during runtime PM suspend, which should save even more power.

The implementation is not the most power efficient because it needs some
interaction from the userspace (e.g close the device node whenever we are
no more interested in getting events), nevertheless it allows us to save
some power and works with devices that are not wake capable.

Signed-off-by: Mika Westerberg 
---
v2:
  - Update changelog to mention that ACPI power domain for example can
power off the device on suspend.
  - Make i2c_hid_power to just call RPM get/put

 drivers/hid/i2c-hid/i2c-hid.c | 68 ---
 1 file changed, 57 insertions(+), 11 deletions(-)

diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c
index d1f81f52481a..923ff818a1bf 100644
--- a/drivers/hid/i2c-hid/i2c-hid.c
+++ b/drivers/hid/i2c-hid/i2c-hid.c
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -454,10 +455,18 @@ static void i2c_hid_init_reports(struct hid_device *hid)
return;
}
 
+   /*
+* The device must be powered on while we fetch initial reports
+* from it.
+*/
+   pm_runtime_get_sync(&client->dev);
+
list_for_each_entry(report,
&hid->report_enum[HID_FEATURE_REPORT].report_list, list)
i2c_hid_init_report(report, inbuf, ihid->bufsize);
 
+   pm_runtime_put(&client->dev);
+
kfree(inbuf);
 }
 
@@ -703,8 +712,8 @@ static int i2c_hid_open(struct hid_device *hid)
 
mutex_lock(&i2c_hid_open_mut);
if (!hid->open++) {
-   ret = i2c_hid_set_power(client, I2C_HID_PWR_ON);
-   if (ret) {
+   ret = pm_runtime_get_sync(&client->dev);
+   if (ret < 0) {
hid->open--;
goto done;
}
@@ -712,7 +721,7 @@ static int i2c_hid_open(struct hid_device *hid)
}
 done:
mutex_unlock(&i2c_hid_open_mut);
-   return ret;
+   return ret < 0 ? ret : 0;
 }
 
 static void i2c_hid_close(struct hid_device *hid)
@@ -729,7 +738,7 @@ static void i2c_hid_close(struct hid_device *hid)
clear_bit(I2C_HID_STARTED, &ihid->flags);
 
/* Save some power */
-   i2c_hid_set_power(client, I2C_HID_PWR_SLEEP);
+   pm_runtime_put(&client->dev);
}
mutex_unlock(&i2c_hid_open_mut);
 }
@@ -738,19 +747,18 @@ static int i2c_hid_power(struct hid_device *hid, int lvl)
 {
struct i2c_client *client = hid->driver_data;
struct i2c_hid *ihid = i2c_get_clientdata(client);
-   int ret = 0;
 
i2c_hid_dbg(ihid, "%s lvl:%d\n", __func__, lvl);
 
switch (lvl) {
case PM_HINT_FULLON:
-   ret = i2c_hid_set_power(client, I2C_HID_PWR_ON);
+   pm_runtime_get_sync(&client->dev);
break;
case PM_HINT_NORMAL:
-   ret = i2c_hid_set_power(client, I2C_HID_PWR_SLEEP);
+   pm_runtime_put(&client->dev);
break;
}
-   return ret;
+   return 0;
 }
 
 static struct hid_ll_driver i2c_hid_ll_driver = {
@@ -973,13 +981,17 @@ static int i2c_hid_probe(struct i2c_client *client,
if (ret < 0)
goto err;
 
+   pm_runtime_get_noresume(&client->dev);
+   pm_runtime_set_active(&client->dev);
+   pm_runtime_enable(&client->dev);
+
ret = i2c_hid_fetch_hid_descriptor(ihid);
if (ret < 0)
-   goto err;
+   goto err_pm;
 
ret = i2c_hid_init_irq(client);
if (ret < 0)
-   goto err;
+   goto err_pm;
 
hid = hid_allocate_device();
if (IS_ERR(hid)) {
@@ -1010,6 +1022,7 @@ static int i2c_hid_probe(struct i2c_client *client,
goto err_mem_free;
}
 
+   pm_runtime_put(&client->dev);
return 0;
 
 err_mem_free:
@@ -1018,6 +1031,10 @@ err_mem_free:
 err_irq:
free_irq(client->irq, ihid);
 
+err_pm:
+   pm_runtime_put_noidle(&client->dev);
+   pm_runtime_disable(&client->dev);
+
 err:
i2c_hid_free_buffers(ihid);
kfree(ihid);
@@ -1029,6 +1046,11 @@ static int i2c_hid_remove(struct i2c_client *client)
struct i2c_hid *ihid = i2c_get_clientdata(client);
struct hid_device *hid;
 
+   pm_runtime_get_sync(&client->dev);
+   pm_runtime_disable(&client->dev);
+   pm_runtime_set_suspended(&client->dev);
+   pm_runtime_put_noidle(&client->dev);
+
hid = ihid->hid;
hid_destroy_device(hid);
 
@@ -1074,7 +1096,31 @@ static int i2c_hid_resume(struct device *dev)
 }
 #endif
 
-static SIMPLE_DEV

[PATCH v5 20/23] drm/i2c: tda998x: add the active aspect in HDMI AVI frame

2014-01-29 Thread Jean-Francois Moine
The picture aspect setting was zero, which is reserved.
A setting of Same As Picture makes more sense.

Tested-by: Russell King 
Signed-off-by: Jean-Francois Moine 
---
 drivers/gpu/drm/i2c/tda998x_drv.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c 
b/drivers/gpu/drm/i2c/tda998x_drv.c
index 1242da1..dba5b96 100644
--- a/drivers/gpu/drm/i2c/tda998x_drv.c
+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
@@ -616,6 +616,7 @@ tda998x_write_avi(struct tda998x_priv *priv, struct 
drm_display_mode *mode)
buf[HB(1)] = 0x02;
buf[HB(2)] = HDMI_AVI_INFOFRAME_SIZE;
buf[PB(1)] = HDMI_SCAN_MODE_UNDERSCAN;
+   buf[PB(2)] = HDMI_ACTIVE_ASPECT_PICTURE;
buf[PB(3)] = HDMI_QUANTIZATION_RANGE_FULL << 2;
buf[PB(4)] = drm_match_cea_mode(mode);
 
-- 
1.9.rc1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v5 18/23] drm/i2c: tda998x: make the audio code more readable

2014-01-29 Thread Jean-Francois Moine
This patch adds a definition of the values of the MUX_AP register and
simplifies the macro's defining the fields of the AIP_CLKSEL register.
This makes the format specific audio init sequence more readable.

Tested-by: Russell King 
Signed-off-by: Jean-Francois Moine 
---
 drivers/gpu/drm/i2c/tda998x_drv.c | 25 +
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c 
b/drivers/gpu/drm/i2c/tda998x_drv.c
index 873e1e9..3e56302 100644
--- a/drivers/gpu/drm/i2c/tda998x_drv.c
+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
@@ -126,6 +126,8 @@ struct tda998x_priv {
 # define VIP_CNTRL_5_CKCASE   (1 << 0)
 # define VIP_CNTRL_5_SP_CNT(x)(((x) & 3) << 1)
 #define REG_MUX_APREG(0x00, 0x26) /* read/write */
+# define MUX_AP_SELECT_I2S   0x64
+# define MUX_AP_SELECT_SPDIF 0x40
 #define REG_MUX_VP_VIP_OUTREG(0x00, 0x27) /* read/write */
 #define REG_MAT_CONTRLREG(0x00, 0x80) /* write */
 # define MAT_CONTRL_MAT_SC(x) (((x) & 3) << 0)
@@ -203,10 +205,11 @@ struct tda998x_priv {
 #define REG_I2S_FORMATREG(0x00, 0xfc) /* read/write */
 # define I2S_FORMAT(x)(((x) & 3) << 0)
 #define REG_AIP_CLKSELREG(0x00, 0xfd) /* write */
-# define AIP_CLKSEL_FS(x) (((x) & 3) << 0)
-# define AIP_CLKSEL_CLK_POL(x)(((x) & 1) << 2)
-# define AIP_CLKSEL_AIP(x)(((x) & 7) << 3)
-
+# define AIP_CLKSEL_AIP_SPDIF(0 << 3)
+# define AIP_CLKSEL_AIP_I2S  (1 << 3)
+# define AIP_CLKSEL_FS_ACLK  (0 << 0)
+# define AIP_CLKSEL_FS_MCLK  (1 << 0)
+# define AIP_CLKSEL_FS_FS64SPDIF  (2 << 0)
 
 /* Page 02h: PLL settings */
 #define REG_PLL_SERIAL_1  REG(0x02, 0x00) /* read/write */
@@ -645,19 +648,17 @@ tda998x_configure_audio(struct tda998x_priv *priv,
/* Set audio input source */
switch (p->audio_format) {
case AFMT_SPDIF:
-   reg_write(priv, REG_MUX_AP, 0x40);
-   clksel_aip = AIP_CLKSEL_AIP(0);
-   /* FS64SPDIF */
-   clksel_fs = AIP_CLKSEL_FS(2);
+   reg_write(priv, REG_MUX_AP, MUX_AP_SELECT_SPDIF);
+   clksel_aip = AIP_CLKSEL_AIP_SPDIF;
+   clksel_fs = AIP_CLKSEL_FS_FS64SPDIF;
cts_n = CTS_N_M(3) | CTS_N_K(3);
ca_i2s = 0;
break;
 
case AFMT_I2S:
-   reg_write(priv, REG_MUX_AP, 0x64);
-   clksel_aip = AIP_CLKSEL_AIP(1);
-   /* ACLK */
-   clksel_fs = AIP_CLKSEL_FS(0);
+   reg_write(priv, REG_MUX_AP, MUX_AP_SELECT_I2S);
+   clksel_aip = AIP_CLKSEL_AIP_I2S;
+   clksel_fs = AIP_CLKSEL_FS_ACLK;
cts_n = CTS_N_M(3) | CTS_N_K(3);
ca_i2s = CA_I2S_CA_I2S(0);
break;
-- 
1.9.rc1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v5 21/23] drm/i2c: tda998x: change the frequence in the audio channel

2014-01-29 Thread Jean-Francois Moine
This patch sets the frequence as 'not indicated' instead of '48kHz'
and uses the asound values in the channel status definition.

Signed-off-by: Jean-Francois Moine 
---
 drivers/gpu/drm/i2c/tda998x_drv.c | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c 
b/drivers/gpu/drm/i2c/tda998x_drv.c
index dba5b96..dedeb22 100644
--- a/drivers/gpu/drm/i2c/tda998x_drv.c
+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
@@ -20,6 +20,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -710,10 +711,11 @@ tda998x_configure_audio(struct tda998x_priv *priv,
reg_clear(priv, REG_AIP_CNTRL_0, AIP_CNTRL_0_RST_CTS);
 
/* Write the channel status */
-   buf[0] = 0x04;
+   buf[0] = IEC958_AES0_CON_NOT_COPYRIGHT;
buf[1] = 0x00;
-   buf[2] = 0x00;
-   buf[3] = 0xf1;
+   buf[2] = IEC958_AES3_CON_FS_NOTID;
+   buf[3] = IEC958_AES4_CON_ORIGFS_NOTID |
+   IEC958_AES4_CON_MAX_WORDLEN_24;
reg_write_range(priv, REG_CH_STAT_B(0), buf, 4);
 
tda998x_audio_mute(priv, true);
-- 
1.9.rc1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v5 22/23] drm/i2c: tda998x: code optimization

2014-01-29 Thread Jean-Francois Moine
This patch reduces the number of I2C exchanges by setting many bits in
one write and removing a useless write.

Signed-off-by: Jean-Francois Moine 
---
 drivers/gpu/drm/i2c/tda998x_drv.c | 12 
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c 
b/drivers/gpu/drm/i2c/tda998x_drv.c
index dedeb22..4f1a047 100644
--- a/drivers/gpu/drm/i2c/tda998x_drv.c
+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
@@ -669,10 +669,8 @@ tda998x_configure_audio(struct tda998x_priv *priv,
}
 
reg_write(priv, REG_AIP_CLKSEL, clksel_aip);
-   reg_clear(priv, REG_AIP_CNTRL_0, AIP_CNTRL_0_LAYOUT);
-
-   /* Enable automatic CTS generation */
-   reg_clear(priv, REG_AIP_CNTRL_0, AIP_CNTRL_0_ACR_MAN);
+   reg_clear(priv, REG_AIP_CNTRL_0, AIP_CNTRL_0_LAYOUT |
+   AIP_CNTRL_0_ACR_MAN);   /* auto CTS */
reg_write(priv, REG_CTS_N, cts_n);
 
/*
@@ -908,10 +906,10 @@ tda998x_encoder_mode_set(struct drm_encoder *encoder,
reg_write(priv, REG_VIP_CNTRL_5, VIP_CNTRL_5_SP_CNT(0));
reg_write(priv, REG_VIP_CNTRL_4, VIP_CNTRL_4_BLANKIT(0) |
VIP_CNTRL_4_BLC(0));
-   reg_clear(priv, REG_PLL_SERIAL_3, PLL_SERIAL_3_SRL_CCIR);
 
reg_clear(priv, REG_PLL_SERIAL_1, PLL_SERIAL_1_SRL_MAN_IZ);
-   reg_clear(priv, REG_PLL_SERIAL_3, PLL_SERIAL_3_SRL_DE);
+   reg_clear(priv, REG_PLL_SERIAL_3, PLL_SERIAL_3_SRL_CCIR |
+ PLL_SERIAL_3_SRL_DE);
reg_write(priv, REG_SERIALIZER, 0);
reg_write(priv, REG_HVF_CNTRL_1, HVF_CNTRL_1_VQR(0));
 
@@ -931,8 +929,6 @@ tda998x_encoder_mode_set(struct drm_encoder *encoder,
/* set BIAS tmds value: */
reg_write(priv, REG_ANA_GENERAL, 0x09);
 
-   reg_write(priv, REG_TBG_CNTRL_0, 0);
-
/*
 * Sync on rising HSYNC/VSYNC
 */
-- 
1.9.rc1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v5 19/23] drm/i2c: tda998x: remove the unused variable ca_i2s

2014-01-29 Thread Jean-Francois Moine
ca_i2s is only ever written to, but never read, so let's get rid of it.

Tested-by: Russell King 
Signed-off-by: Jean-Francois Moine 
---
 drivers/gpu/drm/i2c/tda998x_drv.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c 
b/drivers/gpu/drm/i2c/tda998x_drv.c
index 3e56302..1242da1 100644
--- a/drivers/gpu/drm/i2c/tda998x_drv.c
+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
@@ -638,7 +638,7 @@ static void
 tda998x_configure_audio(struct tda998x_priv *priv,
struct drm_display_mode *mode, struct tda998x_encoder_params *p)
 {
-   uint8_t buf[6], clksel_aip, clksel_fs, ca_i2s, cts_n, adiv;
+   uint8_t buf[6], clksel_aip, clksel_fs, cts_n, adiv;
uint32_t n;
 
/* Enable audio ports */
@@ -652,7 +652,6 @@ tda998x_configure_audio(struct tda998x_priv *priv,
clksel_aip = AIP_CLKSEL_AIP_SPDIF;
clksel_fs = AIP_CLKSEL_FS_FS64SPDIF;
cts_n = CTS_N_M(3) | CTS_N_K(3);
-   ca_i2s = 0;
break;
 
case AFMT_I2S:
@@ -660,7 +659,6 @@ tda998x_configure_audio(struct tda998x_priv *priv,
clksel_aip = AIP_CLKSEL_AIP_I2S;
clksel_fs = AIP_CLKSEL_FS_ACLK;
cts_n = CTS_N_M(3) | CTS_N_K(3);
-   ca_i2s = CA_I2S_CA_I2S(0);
break;
 
default:
-- 
1.9.rc1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v5 23/23] drm/i2c: tda998x: adjust the audio clock divider for S/PDIF

2014-01-29 Thread Jean-Francois Moine
According to some tests on the Cubox (Marvell Armada 510 + TDA19988),
the S/PDIF input asks for a greater audio clock divider.

Signed-off-by: Jean-Francois Moine 
---
 drivers/gpu/drm/i2c/tda998x_drv.c | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c 
b/drivers/gpu/drm/i2c/tda998x_drv.c
index 4f1a047..2f97290 100644
--- a/drivers/gpu/drm/i2c/tda998x_drv.c
+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
@@ -680,10 +680,14 @@ tda998x_configure_audio(struct tda998x_priv *priv,
 * There is no detailed info in the datasheet, so we just
 * assume 100MHz requires larger divider.
 */
+   adiv = AUDIO_DIV_SERCLK_8;
if (mode->clock > 10)
-   adiv = AUDIO_DIV_SERCLK_16;
-   else
-   adiv = AUDIO_DIV_SERCLK_8;
+   adiv++; /* AUDIO_DIV_SERCLK_16 */
+
+   /* S/PDIF asks for a larger divider */
+   if (p->audio_format == AFMT_SPDIF)
+   adiv++; /* AUDIO_DIV_SERCLK_16 or _32 */
+
reg_write(priv, REG_AUDIO_DIV, adiv);
 
/*
-- 
1.9.rc1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [GIT PULL] Core block IO changes for 3.14

2014-01-29 Thread Geert Uytterhoeven
On Tue, Jan 28, 2014 at 11:52 PM, Jens Axboe  wrote:
>> - Finally the immutable biovec changes from Kent Overstreet. This
>>   enables some nice future work on making arbitrarily sized bios
>>   possible, and splitting more efficient. Related fixes to immutable
>>   bio_vecs:
>>
>> - dm-cache immutable fixup from Mike Snitzer.
>> - btrfs immutable fixup from Muthu Kumar.
>>
>> - bio-integrity fix from Nic Bellinger, which is also going to stable.
>>
>>
>> Please pull! There will be a bit of merge work for you, but it should be
>> fairly straight forward. It's mostly related to changin:
>>
>> bio->bi_sector  -> bio->bi_iter.bi_sector
>> bio->bi_size-> bio->bi_iter.bi_size
>>
>>
>> git://git.kernel.dk/linux-block.git for-3.14/core
>
> BTW, let me know if you want me to merge this. The above has been in
> for-next since forever, and Stephen has carried a fix or two for new
> merges.

arch/xtensa/platforms/iss/simdisk.c:108:23: error: 'struct bio' has no
member named 'bi_sector'

http://kisskb.ellerman.id.au/kisskb/buildresult/10542666/

Reported before at:
http://www.spinics.net/lists/dm-devel/msg20937.html

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 9/9 v5] crypto:s5p-sss: Look for the next request in the queue

2014-01-29 Thread Naveen Krishna Chatradhi
From: Naveen Krishna Ch 

Currently, the driver enqueues a request only if the busy bit is
false. And every request initiates a dequeue. If 2 requests arrive
simultaneously, only one of them will be dequeued.

To avoid this senario, we will enqueue the next request irrespective
of the system condition (that is what queue is here for). Also
schedule at a tasklet immediatly after the current request is done.
The tasklet will dequeue the next request in the queue, giving
continuous loop. tasklet will exit if there are no requests in the
queue.

Signed-off-by: Naveen Krishna Ch 
---
This is a new fix in this patchset, tested with dm-crypt/ecryptfs

 drivers/crypto/s5p-sss.c |   17 -
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/crypto/s5p-sss.c b/drivers/crypto/s5p-sss.c
index 5bd3bd9..d37cbfc 100644
--- a/drivers/crypto/s5p-sss.c
+++ b/drivers/crypto/s5p-sss.c
@@ -330,8 +330,12 @@ static void s5p_aes_tx(struct s5p_aes_dev *dev)
}
 
s5p_set_dma_outdata(dev, dev->sg_dst);
-   } else
+   } else {
s5p_aes_complete(dev, err);
+
+   dev->busy = true;
+   tasklet_schedule(&dev->tasklet);
+   }
 }
 
 static void s5p_aes_rx(struct s5p_aes_dev *dev)
@@ -469,10 +473,13 @@ static void s5p_tasklet_cb(unsigned long data)
spin_lock_irqsave(&dev->lock, flags);
backlog   = crypto_get_backlog(&dev->queue);
async_req = crypto_dequeue_request(&dev->queue);
-   spin_unlock_irqrestore(&dev->lock, flags);
 
-   if (!async_req)
+   if (!async_req) {
+   dev->busy = false;
+   spin_unlock_irqrestore(&dev->lock, flags);
return;
+   }
+   spin_unlock_irqrestore(&dev->lock, flags);
 
if (backlog)
backlog->complete(backlog, -EINPROGRESS);
@@ -491,14 +498,13 @@ static int s5p_aes_handle_req(struct s5p_aes_dev *dev,
int err;
 
spin_lock_irqsave(&dev->lock, flags);
+   err = ablkcipher_enqueue_request(&dev->queue, req);
if (dev->busy) {
-   err = -EAGAIN;
spin_unlock_irqrestore(&dev->lock, flags);
goto exit;
}
dev->busy = true;
 
-   err = ablkcipher_enqueue_request(&dev->queue, req);
spin_unlock_irqrestore(&dev->lock, flags);
 
tasklet_schedule(&dev->tasklet);
@@ -688,6 +694,7 @@ static int s5p_aes_probe(struct platform_device *pdev)
}
}
 
+   pdata->busy = false;
pdata->variant = variant;
pdata->dev = dev;
platform_set_drvdata(pdev, pdata);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 8/9 v5] crypto:s5p-sss: Use clk_prepare/clk_unprepare

2014-01-29 Thread Naveen Krishna Chatradhi
This patch set adds use of clk_prepare/clk_unprepare as
required by generic clock framework.

Signed-off-by: Naveen Krishna Chatradhi 
Reviewed-by: Tomasz Figa 
---
Changes since v4:
Handle return value of clk_prepare_enable

Changes since v3:
None

 drivers/crypto/s5p-sss.c |   10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/crypto/s5p-sss.c b/drivers/crypto/s5p-sss.c
index a890273..5bd3bd9 100644
--- a/drivers/crypto/s5p-sss.c
+++ b/drivers/crypto/s5p-sss.c
@@ -648,7 +648,11 @@ static int s5p_aes_probe(struct platform_device *pdev)
return -ENOENT;
}
 
-   clk_enable(pdata->clk);
+   err = clk_prepare_enable(pdata->clk);
+   if (err < 0) {
+   dev_err(dev, "Enabling SSS clk failed, err %d\n", err);
+   return err;
+   }
 
spin_lock_init(&pdata->lock);
pdata->ioaddr = devm_ioremap(dev, res->start,
@@ -711,7 +715,7 @@ static int s5p_aes_probe(struct platform_device *pdev)
tasklet_kill(&pdata->tasklet);
 
  err_irq:
-   clk_disable(pdata->clk);
+   clk_disable_unprepare(pdata->clk);
 
s5p_dev = NULL;
 
@@ -731,7 +735,7 @@ static int s5p_aes_remove(struct platform_device *pdev)
 
tasklet_kill(&pdata->tasklet);
 
-   clk_disable(pdata->clk);
+   clk_disable_unprepare(pdata->clk);
 
s5p_dev = NULL;
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v5 17/23] drm/i2c: tda998x: set the PLL division factor in range 0..3

2014-01-29 Thread Jean-Francois Moine
The predivider division factor of the register PLL_SERIAL_2 is in the
range 0..3, the value 0 being used for a division by 1.

Signed-off-by: Jean-Francois Moine 
---
 drivers/gpu/drm/i2c/tda998x_drv.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c 
b/drivers/gpu/drm/i2c/tda998x_drv.c
index 36e95b2..873e1e9 100644
--- a/drivers/gpu/drm/i2c/tda998x_drv.c
+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
@@ -214,7 +214,7 @@ struct tda998x_priv {
 # define PLL_SERIAL_1_SRL_IZ(x)   (((x) & 3) << 1)
 # define PLL_SERIAL_1_SRL_MAN_IZ  (1 << 6)
 #define REG_PLL_SERIAL_2  REG(0x02, 0x01) /* read/write */
-# define PLL_SERIAL_2_SRL_NOSC(x) (((x) & 3) << 0)
+# define PLL_SERIAL_2_SRL_NOSC(x) ((x) << 0)
 # define PLL_SERIAL_2_SRL_PR(x)   (((x) & 0xf) << 4)
 #define REG_PLL_SERIAL_3  REG(0x02, 0x02) /* read/write */
 # define PLL_SERIAL_3_SRL_CCIR(1 << 0)
@@ -886,6 +886,11 @@ tda998x_encoder_mode_set(struct drm_encoder *encoder,
}
 
div = 148500 / mode->clock;
+   if (div != 0) {
+   div--;
+   if (div > 3)
+   div = 3;
+   }
 
/* mute the audio FIFO: */
reg_set(priv, REG_AIP_CNTRL_0, AIP_CNTRL_0_RST_FIFO);
-- 
1.9.rc1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 7/9 v5] crypto:s5p-sss: validate iv before memcpy

2014-01-29 Thread Naveen Krishna Chatradhi
This patch adds code to validate "iv" buffer before trying to
memcpy the contents

Signed-off-by: Naveen Krishna Chatradhi 
Reviewed-by: Tomasz Figa 
---
Changes since v4:
None

Changes since v3:
None

 drivers/crypto/s5p-sss.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/crypto/s5p-sss.c b/drivers/crypto/s5p-sss.c
index da1c8943..a890273 100644
--- a/drivers/crypto/s5p-sss.c
+++ b/drivers/crypto/s5p-sss.c
@@ -380,7 +380,8 @@ static void s5p_set_aes(struct s5p_aes_dev *dev,
 {
void __iomem *keystart;
 
-   memcpy(dev->aes_ioaddr + SSS_REG_AES_IV_DATA (0), iv, 0x10);
+   if (iv)
+   memcpy(dev->aes_ioaddr + SSS_REG_AES_IV_DATA (0), iv, 0x10);
 
if (keylen == AES_KEYSIZE_256)
keystart = dev->aes_ioaddr + SSS_REG_AES_KEY_DATA(0);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [BISECTED] OMAP: DSS: clk rate mismatch

2014-01-29 Thread Ivaylo Dimitrov



On 29.01.2014 11:10, Tero Kristo wrote:



It looks like the omap36xx version of the omap96m_alwon_fck is modelled
improperly in the dts files. I don't have access to omap36xx hardware
myself, but give a try for the following patch:




It could be that 36xx omap96m_alwon_fck clock is wrongly modeled, but I 
am testing on 1) 3430es2 (Nokia N900) and 2) legacy boot, so I guess 
that patch won't help much (unless I am missing something and DT is used 
even with legacy boot and 36xx clocks are used on 3430es2)


Thanks,
Ivo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 6/9 v5] ARM: dts: exynos5250/5420: add dt node for sss module

2014-01-29 Thread Naveen Krishna Chatradhi
This patch adds the device tree node for SSS module
found on Exynos5420 and Exynos5250

Signed-off-by: Naveen Krishna Chatradhi 
Reviewed-by: Tomasz Figa 
TO: 
CC: Kukjin Kim 
CC: 
---
Changes since v4:
None
Changes since v3:
1. Modified the SSS clock ID as per dt-bindings for Exynos5250 in
   samsung-clk.git tree.

 arch/arm/boot/dts/exynos5250.dtsi |8 
 arch/arm/boot/dts/exynos5420.dtsi |   10 ++
 2 files changed, 18 insertions(+)

diff --git a/arch/arm/boot/dts/exynos5250.dtsi 
b/arch/arm/boot/dts/exynos5250.dtsi
index c341e55..1d249df 100644
--- a/arch/arm/boot/dts/exynos5250.dtsi
+++ b/arch/arm/boot/dts/exynos5250.dtsi
@@ -704,4 +704,12 @@
io-channel-ranges;
status = "disabled";
};
+
+   sss@1083 {
+   compatible = "samsung,exynos4210-secss";
+   reg = <0x1083 0x1>;
+   interrupts = <0 112 0>;
+   clocks = <&clock 348>;
+   clock-names = "secss";
+   };
 };
diff --git a/arch/arm/boot/dts/exynos5420.dtsi 
b/arch/arm/boot/dts/exynos5420.dtsi
index 11dd202..56a3f3e 100644
--- a/arch/arm/boot/dts/exynos5420.dtsi
+++ b/arch/arm/boot/dts/exynos5420.dtsi
@@ -652,4 +652,14 @@
clocks = <&clock 319>, <&clock 318>;
clock-names = "tmu_apbif", "tmu_triminfo_apbif";
};
+
+   sss@1083 {
+   compatible = "samsung,exynos4210-secss";
+   reg = <0x1083 0x1>;
+   interrupts = <0 112 0>;
+   clocks = <&clock 471>;
+   clock-names = "secss";
+   samsung,power-domain = <&g2d_pd>;
+   };
+
 };
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 01/13] cgroup: improve css_from_dir() into css_tryget_from_dir()

2014-01-29 Thread Michal Hocko
On Tue 28-01-14 18:54:33, Tejun Heo wrote:
> css_from_dir() returns the matching css (cgroup_subsys_state) given a
> dentry and subsystem.  The function doesn't pin the css before
> returning and requires the caller to be holding RCU read lock or
> cgroup_mutex and handling pinning on the caller side.
> 
> Given that users of the function are likely to want to pin the
> returned css (both existing users do) and that getting and putting
> css's are very cheap, there's no reason for the interface to be tricky
> like this.
> 
> Rename css_from_dir() to css_tryget_from_dir() and make it try to pin
> the found css and return it only if pinning succeeded.  The callers
> are updated so that they no longer do RCU locking and pinning around
> the function and just use the returned css.
> 
> This will also ease converting cgroup to kernfs.
> 
> Signed-off-by: Tejun Heo 
> Cc: Steven Rostedt 
> Cc: Frederic Weisbecker 
> Cc: Ingo Molnar 
> Cc: Johannes Weiner 
> Cc: Michal Hocko 
> Cc: Balbir Singh 
> Cc: KAMEZAWA Hiroyuki 

yes, this is handy.
For memcg part
Acked-by: Michal Hocko 

Thanks!

> ---
>  include/linux/cgroup.h |  4 ++--
>  kernel/cgroup.c| 25 -
>  kernel/events/core.c   | 17 +
>  mm/memcontrol.c| 16 +++-
>  4 files changed, 26 insertions(+), 36 deletions(-)
> 
> diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
> index 198c7fc..2255639 100644
> --- a/include/linux/cgroup.h
> +++ b/include/linux/cgroup.h
> @@ -823,8 +823,8 @@ int css_scan_tasks(struct cgroup_subsys_state *css,
>  int cgroup_attach_task_all(struct task_struct *from, struct task_struct *);
>  int cgroup_transfer_tasks(struct cgroup *to, struct cgroup *from);
>  
> -struct cgroup_subsys_state *css_from_dir(struct dentry *dentry,
> -  struct cgroup_subsys *ss);
> +struct cgroup_subsys_state *css_tryget_from_dir(struct dentry *dentry,
> + struct cgroup_subsys *ss);
>  
>  #else /* !CONFIG_CGROUPS */
>  
> diff --git a/kernel/cgroup.c b/kernel/cgroup.c
> index 3d92fd0..823e250 100644
> --- a/kernel/cgroup.c
> +++ b/kernel/cgroup.c
> @@ -4964,28 +4964,35 @@ static int __init cgroup_disable(char *str)
>  __setup("cgroup_disable=", cgroup_disable);
>  
>  /**
> - * css_from_dir - get corresponding css from the dentry of a cgroup dir
> + * css_tryget_from_dir - get corresponding css from the dentry of a cgroup 
> dir
>   * @dentry: directory dentry of interest
>   * @ss: subsystem of interest
>   *
> - * Must be called under cgroup_mutex or RCU read lock.  The caller is
> - * responsible for pinning the returned css if it needs to be accessed
> - * outside the critical section.
> + * If @dentry is a directory for a cgroup which has @ss enabled on it, try
> + * to get the corresponding css and return it.  If such css doesn't exist
> + * or can't be pinned, an ERR_PTR value is returned.
>   */
> -struct cgroup_subsys_state *css_from_dir(struct dentry *dentry,
> -  struct cgroup_subsys *ss)
> +struct cgroup_subsys_state *css_tryget_from_dir(struct dentry *dentry,
> + struct cgroup_subsys *ss)
>  {
>   struct cgroup *cgrp;
> -
> - cgroup_assert_mutex_or_rcu_locked();
> + struct cgroup_subsys_state *css;
>  
>   /* is @dentry a cgroup dir? */
>   if (!dentry->d_inode ||
>   dentry->d_inode->i_op != &cgroup_dir_inode_operations)
>   return ERR_PTR(-EBADF);
>  
> + rcu_read_lock();
> +
>   cgrp = __d_cgrp(dentry);
> - return cgroup_css(cgrp, ss) ?: ERR_PTR(-ENOENT);
> + css = cgroup_css(cgrp, ss);
> +
> + if (!css || !css_tryget(css))
> + css = ERR_PTR(-ENOENT);
> +
> + rcu_read_unlock();
> + return css;
>  }
>  
>  /**
> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index 6490373..a3c3ab5 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -370,11 +370,6 @@ perf_cgroup_match(struct perf_event *event)
>   event->cgrp->css.cgroup);
>  }
>  
> -static inline bool perf_tryget_cgroup(struct perf_event *event)
> -{
> - return css_tryget(&event->cgrp->css);
> -}
> -
>  static inline void perf_put_cgroup(struct perf_event *event)
>  {
>   css_put(&event->cgrp->css);
> @@ -593,9 +588,7 @@ static inline int perf_cgroup_connect(int fd, struct 
> perf_event *event,
>   if (!f.file)
>   return -EBADF;
>  
> - rcu_read_lock();
> -
> - css = css_from_dir(f.file->f_dentry, &perf_event_cgrp_subsys);
> + css = css_tryget_from_dir(f.file->f_dentry, &perf_event_cgrp_subsys);
>   if (IS_ERR(css)) {
>   ret = PTR_ERR(css);
>   goto out;
> @@ -604,13 +597,6 @@ static inline int perf_cgroup_connect(int fd, struct 
> perf_event *event,
>   cgrp = container_of(css, struct perf_cgroup, css);
>   event->cgrp = cgrp;
>  
> - /* must

[PATCH v5 12/23] drm/i2c: tda998x: add DT support

2014-01-29 Thread Jean-Francois Moine
This patch adds DT support to the tda998x.

Acked-by: Russell King 
Tested-by: Russell King 
Signed-off-by: Jean-Francois Moine 
---
 drivers/gpu/drm/i2c/tda998x_drv.c | 22 ++
 1 file changed, 22 insertions(+)

diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c 
b/drivers/gpu/drm/i2c/tda998x_drv.c
index 351da92..d4074e0 100644
--- a/drivers/gpu/drm/i2c/tda998x_drv.c
+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
@@ -1164,6 +1164,8 @@ tda998x_encoder_init(struct i2c_client *client,
struct drm_encoder_slave *encoder_slave)
 {
struct tda998x_priv *priv;
+   struct device_node *np = client->dev.of_node;
+   u32 video;
int ret;
 
priv = kzalloc(sizeof(*priv), GFP_KERNEL);
@@ -1232,6 +1234,17 @@ tda998x_encoder_init(struct i2c_client *client,
cec_write(priv, REG_CEC_FRO_IM_CLK_CTRL,
CEC_FRO_IM_CLK_CTRL_GHOST_DIS | 
CEC_FRO_IM_CLK_CTRL_IMCLK_SEL);
 
+   if (!np)
+   return 0;   /* non-DT */
+
+   /* get the optional video properties */
+   ret = of_property_read_u32(np, "video-ports", &video);
+   if (ret == 0) {
+   priv->vip_cntrl_0 = video >> 16;
+   priv->vip_cntrl_1 = video >> 8;
+   priv->vip_cntrl_2 = video;
+   }
+
return 0;
 
 fail:
@@ -1246,6 +1259,14 @@ fail:
return -ENXIO;
 }
 
+#ifdef CONFIG_OF
+static const struct of_device_id tda998x_dt_ids[] = {
+   { .compatible = "nxp,tda998x", },
+   { }
+};
+MODULE_DEVICE_TABLE(of, tda998x_dt_ids);
+#endif
+
 static struct i2c_device_id tda998x_ids[] = {
{ "tda998x", 0 },
{ }
@@ -1258,6 +1279,7 @@ static struct drm_i2c_encoder_driver tda998x_driver = {
.remove = tda998x_remove,
.driver = {
.name = "tda998x",
+   .of_match_table = of_match_ptr(tda998x_dt_ids),
},
.id_table = tda998x_ids,
},
-- 
1.9.rc1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v5 11/23] drm/i2c: tda998x: check the CEC device creation

2014-01-29 Thread Jean-Francois Moine
This patch checks if the CEC device is well created at intialization
time.

Acked-by: Russell King 
Tested-by: Russell King 
Signed-off-by: Jean-Francois Moine 
---
 drivers/gpu/drm/i2c/tda998x_drv.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c 
b/drivers/gpu/drm/i2c/tda998x_drv.c
index 7d8bc22..351da92 100644
--- a/drivers/gpu/drm/i2c/tda998x_drv.c
+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
@@ -1177,6 +1177,8 @@ tda998x_encoder_init(struct i2c_client *client,
priv->current_page = 0xff;
priv->hdmi = client;
priv->cec = i2c_new_dummy(client->adapter, 0x34);
+   if (!priv->cec)
+   return -ENODEV;
priv->dpms = DRM_MODE_DPMS_OFF;
 
encoder_slave->slave_priv = priv;
-- 
1.9.rc1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 5/9 v5] clk: samsung exynos5250/5420: Add gate clock for SSS module

2014-01-29 Thread Naveen Krishna Chatradhi
This patch adds gating clock for SSS(Security SubSystem)
module on Exynos5250/5420.

Signed-off-by: Naveen Krishna Chatradhi 
TO: 
TO: Tomasz Figa 
CC: Kukjin Kim 
CC: 
---
Changes since v4:
Use register GATE_IP_G2D instead of GATE_BUS_G2D for Exynos5420
Changes since v3:
1. Rebased on to 
https://git.kernel.org/pub/scm/linux/kernel/git/tfiga/samsung-clk.git
2. Added new ID for SSS clock on Exynos5250, with Documentation and 
3. Added gate clocks definitions for SSS on Exynos5420 and Exynos5250
 .../devicetree/bindings/clock/exynos5250-clock.txt |1 +
 drivers/clk/samsung/clk-exynos5250.c   |1 +
 drivers/clk/samsung/clk-exynos5420.c   |4 
 include/dt-bindings/clock/exynos5250.h |1 +
 4 files changed, 7 insertions(+)

diff --git a/Documentation/devicetree/bindings/clock/exynos5250-clock.txt 
b/Documentation/devicetree/bindings/clock/exynos5250-clock.txt
index 492ed09..a845fc6 100644
--- a/Documentation/devicetree/bindings/clock/exynos5250-clock.txt
+++ b/Documentation/devicetree/bindings/clock/exynos5250-clock.txt
@@ -162,6 +162,7 @@ clock which they consume.
   g2d  345
   mdma0346
   smmu_mdma0   347
+  sss  348
 
 
[Clock Muxes]
diff --git a/drivers/clk/samsung/clk-exynos5250.c 
b/drivers/clk/samsung/clk-exynos5250.c
index ff4beeb..2c52fe1 100644
--- a/drivers/clk/samsung/clk-exynos5250.c
+++ b/drivers/clk/samsung/clk-exynos5250.c
@@ -387,6 +387,7 @@ static struct samsung_gate_clock exynos5250_gate_clks[] 
__initdata = {
 * CMU_ACP
 */
GATE(CLK_MDMA0, "mdma0", "div_aclk266", GATE_IP_ACP, 1, 0, 0),
+   GATE(CLK_SSS, "sss", "div_aclk266", GATE_IP_ACP, 2, 0, 0),
GATE(CLK_G2D, "g2d", "div_aclk200", GATE_IP_ACP, 3, 0, 0),
GATE(CLK_SMMU_MDMA0, "smmu_mdma0", "div_aclk266", GATE_IP_ACP, 5, 0, 0),
 
diff --git a/drivers/clk/samsung/clk-exynos5420.c 
b/drivers/clk/samsung/clk-exynos5420.c
index ab4f2f7..c93d4d5 100644
--- a/drivers/clk/samsung/clk-exynos5420.c
+++ b/drivers/clk/samsung/clk-exynos5420.c
@@ -26,6 +26,7 @@
 #define DIV_CPU1   0x504
 #define GATE_BUS_CPU   0x700
 #define GATE_SCLK_CPU  0x800
+#define GATE_IP_G2D0x8800
 #define CPLL_LOCK  0x10020
 #define DPLL_LOCK  0x10030
 #define EPLL_LOCK  0x10040
@@ -702,6 +703,9 @@ static struct samsung_gate_clock exynos5420_gate_clks[] 
__initdata = {
0),
GATE(CLK_SMMU_MIXER, "smmu_mixer", "aclk200_disp1", GATE_IP_DISP1, 9, 0,
0),
+
+   /* SSS */
+   GATE(CLK_SSS, "sss", "aclk266_g2d", GATE_IP_G2D, 2, 0, 0),
 };
 
 static struct samsung_pll_clock exynos5420_plls[nr_plls] __initdata = {
diff --git a/include/dt-bindings/clock/exynos5250.h 
b/include/dt-bindings/clock/exynos5250.h
index 922f2dc..f9b452b 100644
--- a/include/dt-bindings/clock/exynos5250.h
+++ b/include/dt-bindings/clock/exynos5250.h
@@ -150,6 +150,7 @@
 #define CLK_G2D345
 #define CLK_MDMA0  346
 #define CLK_SMMU_MDMA0 347
+#define CLK_SSS348
 
 /* mux clocks */
 #define CLK_MOUT_HDMI  1024
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v5 02/23] drm/i2c: tda998x: check more I/O errors

2014-01-29 Thread Jean-Francois Moine
This patch adds more error checking inn I2C I/O functions.
In case of I/O error, this permits to avoid writing in bad controller
pages, a bad chipset detection or looping when getting the EDID.

Acked-by: Russell King 
Tested-by: Russell King 
Signed-off-by: Jean-Francois Moine 
---
 drivers/gpu/drm/i2c/tda998x_drv.c | 57 +--
 1 file changed, 43 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c 
b/drivers/gpu/drm/i2c/tda998x_drv.c
index 26dd299..11f0607 100644
--- a/drivers/gpu/drm/i2c/tda998x_drv.c
+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
@@ -362,7 +362,7 @@ fail:
return 0;
 }
 
-static void
+static int
 set_page(struct tda998x_priv *priv, uint16_t reg)
 {
if (REG2PAGE(reg) != priv->current_page) {
@@ -371,11 +371,14 @@ set_page(struct tda998x_priv *priv, uint16_t reg)
REG_CURPAGE, REG2PAGE(reg)
};
int ret = i2c_master_send(client, buf, sizeof(buf));
-   if (ret < 0)
+   if (ret < 0) {
dev_err(&client->dev, "Error %d writing to 
REG_CURPAGE\n", ret);
+   return ret;
+   }
 
priv->current_page = REG2PAGE(reg);
}
+   return 0;
 }
 
 static int
@@ -385,7 +388,9 @@ reg_read_range(struct tda998x_priv *priv, uint16_t reg, 
char *buf, int cnt)
uint8_t addr = REG2ADDR(reg);
int ret;
 
-   set_page(priv, reg);
+   ret = set_page(priv, reg);
+   if (ret < 0)
+   return ret;
 
ret = i2c_master_send(client, &addr, sizeof(addr));
if (ret < 0)
@@ -412,18 +417,24 @@ reg_write_range(struct tda998x_priv *priv, uint16_t reg, 
uint8_t *p, int cnt)
buf[0] = REG2ADDR(reg);
memcpy(&buf[1], p, cnt);
 
-   set_page(priv, reg);
+   ret = set_page(priv, reg);
+   if (ret < 0)
+   return;
 
ret = i2c_master_send(client, buf, cnt + 1);
if (ret < 0)
dev_err(&client->dev, "Error %d writing to 0x%x\n", ret, reg);
 }
 
-static uint8_t
+static int
 reg_read(struct tda998x_priv *priv, uint16_t reg)
 {
uint8_t val = 0;
-   reg_read_range(priv, reg, &val, sizeof(val));
+   int ret;
+
+   ret = reg_read_range(priv, reg, &val, sizeof(val));
+   if (ret < 0)
+   return ret;
return val;
 }
 
@@ -434,7 +445,9 @@ reg_write(struct tda998x_priv *priv, uint16_t reg, uint8_t 
val)
uint8_t buf[] = {REG2ADDR(reg), val};
int ret;
 
-   set_page(priv, reg);
+   ret = set_page(priv, reg);
+   if (ret < 0)
+   return;
 
ret = i2c_master_send(client, buf, ARRAY_SIZE(buf));
if (ret < 0)
@@ -448,7 +461,9 @@ reg_write16(struct tda998x_priv *priv, uint16_t reg, 
uint16_t val)
uint8_t buf[] = {REG2ADDR(reg), val >> 8, val};
int ret;
 
-   set_page(priv, reg);
+   ret = set_page(priv, reg);
+   if (ret < 0)
+   return;
 
ret = i2c_master_send(client, buf, ARRAY_SIZE(buf));
if (ret < 0)
@@ -458,13 +473,21 @@ reg_write16(struct tda998x_priv *priv, uint16_t reg, 
uint16_t val)
 static void
 reg_set(struct tda998x_priv *priv, uint16_t reg, uint8_t val)
 {
-   reg_write(priv, reg, reg_read(priv, reg) | val);
+   int old_val;
+
+   old_val = reg_read(priv, reg);
+   if (old_val >= 0)
+   reg_write(priv, reg, old_val | val);
 }
 
 static void
 reg_clear(struct tda998x_priv *priv, uint16_t reg, uint8_t val)
 {
-   reg_write(priv, reg, reg_read(priv, reg) & ~val);
+   int old_val;
+
+   old_val = reg_read(priv, reg);
+   if (old_val >= 0)
+   reg_write(priv, reg, old_val & ~val);
 }
 
 static void
@@ -970,8 +993,10 @@ read_edid_block(struct drm_encoder *encoder, uint8_t *buf, 
int blk)
 
/* wait for block read to complete: */
for (i = 100; i > 0; i--) {
-   uint8_t val = reg_read(priv, REG_INT_FLAGS_2);
-   if (val & INT_FLAGS_2_EDID_BLK_RD)
+   ret = reg_read(priv, REG_INT_FLAGS_2);
+   if (ret < 0)
+   return ret;
+   if (ret & INT_FLAGS_2_EDID_BLK_RD)
break;
msleep(1);
}
@@ -1134,6 +1159,7 @@ tda998x_encoder_init(struct i2c_client *client,
struct drm_encoder_slave *encoder_slave)
 {
struct tda998x_priv *priv;
+   int ret;
 
priv = kzalloc(sizeof(*priv), GFP_KERNEL);
if (!priv)
@@ -1158,8 +1184,11 @@ tda998x_encoder_init(struct i2c_client *client,
tda998x_reset(priv);
 
/* read version: */
-   priv->rev = reg_read(priv, REG_VERSION_LSB) |
-   reg_read(priv, REG_VERSION_MSB) << 8;
+   ret = reg_read(priv, REG_VERSION_LSB) |
+   (reg_read(priv, REG_VERSION_MSB) << 8);
+   if (ret < 0)
+   goto fail;
+   priv->rev = ret;
 
  

Re: [PATCH 4/4] power_supply: bq24261 charger driver

2014-01-29 Thread Pavel Machek
On Wed 2014-01-29 18:53:34, Jenny Tc wrote:
> On Tue, Jan 28, 2014 at 07:14:45AM -0700, Pavel Machek wrote:
> > > +#define BQ24261_ICHRG_MASK   (0x1F << 3)
> > > +#define BQ24261_ICHRG_100ma  (0x01 << 3)
> > > +#define BQ24261_ICHRG_200ma  (0x01 << 4)
> > > +#define BQ24261_ICHRG_400ma  (0x01 << 5)
> > > +#define BQ24261_ICHRG_800ma  (0x01 << 6)
> > > +#define BQ24261_ICHRG_1600ma (0x01 << 7)
> > 
> > First, its mA, not ma.
> 
> Camel Case allowed? Ignore Checkpatch.pl warning?

This is not camel case, this is mili ampers. 

> > (x/50) << 3, right ?
> 
> Few register settings need table mapping, but some can have logic as your
> comment say. Just wanted to keep same logic for all register settings.
> Doesn't it make more readable?

No, it is definitely not readable. Please use logic where you can.

Thanks,
Pavel

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [BISECTED] OMAP: DSS: clk rate mismatch

2014-01-29 Thread Tomi Valkeinen
On 2014-01-29 11:29, Ivaylo Dimitrov wrote:
> 
> 
> On 29.01.2014 11:10, Tero Kristo wrote:
> 
>>
>> It looks like the omap36xx version of the omap96m_alwon_fck is modelled
>> improperly in the dts files. I don't have access to omap36xx hardware
>> myself, but give a try for the following patch:
>>
>>
> 
> It could be that 36xx omap96m_alwon_fck clock is wrongly modeled, but I
> am testing on 1) 3430es2 (Nokia N900) and 2) legacy boot, so I guess
> that patch won't help much (unless I am missing something and DT is used
> even with legacy boot and 36xx clocks are used on 3430es2)

I think Tero's reply was to Christoph. I believe the issues you see and
what Christoph sees are totally different.

 Tomi




signature.asc
Description: OpenPGP digital signature


Re: [BISECTED] OMAP: DSS: clk rate mismatch

2014-01-29 Thread Tero Kristo

On 01/29/2014 11:38 AM, Tomi Valkeinen wrote:

On 2014-01-29 11:29, Ivaylo Dimitrov wrote:



On 29.01.2014 11:10, Tero Kristo wrote:



It looks like the omap36xx version of the omap96m_alwon_fck is modelled
improperly in the dts files. I don't have access to omap36xx hardware
myself, but give a try for the following patch:




It could be that 36xx omap96m_alwon_fck clock is wrongly modeled, but I
am testing on 1) 3430es2 (Nokia N900) and 2) legacy boot, so I guess
that patch won't help much (unless I am missing something and DT is used
even with legacy boot and 36xx clocks are used on 3430es2)


I think Tero's reply was to Christoph. I believe the issues you see and
what Christoph sees are totally different.

  Tomi


Oh yea sorry about the confusion, have too many separate issues listed 
under this thread. :P That was definitely for Christoph.


For the DSS clk rate part, Tomi should answer that as it seems to come 
from some display driver changes. This might be caused by the infamous 
rounding issues with the clk_set_rate / clk_round_rate and the hackery 
around it in display driver...


-Tero

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Query: Phy: How to find consumer device on dt platform

2014-01-29 Thread Pratyush Anand
Hi Arnd / Kishon,

Thanks for your inputs.

On Wed, Jan 29, 2014 at 01:41:56PM +0800, Kishon Vijay Abraham I wrote:
> Hi,
> 
> On Wednesday 29 January 2014 02:56 AM, Arnd Bergmann wrote:
> > On Tuesday 28 January 2014, Kishon Vijay Abraham I wrote:
> >>> I have a common set of registers, which need to be programmed
> >>> differently for PCIe and SATA during phy init/exit.
> >>
> >> One way is differentiate using different compatible strings fro pcie and 
> >> sata
> >> and use of_device_is_compatible to select a particular path.
> > 
> > But if the IP block is the same, the compatible string should be
> > identical.
> 
> Actually we define the compatible for 'device' no?. Here the same IP is
> configured differently as different devices in SoCs.
> > 
> >>> Therefore, in the init/exit routine of phy_ops, I need some way of
> >>> identifying that phy_init/exit has been called from PCIe driver or
> >>> SATA driver.
> >>
> >> In this case you'll be actually registering two different PHYs (each for 
> >> pcie
> >> and sata), so your phy_get should give you the only the appropriate phy.
> > 
> > I would instead recommend making the mode of the PHY device the
> > argument to the phy handle in DT, so that the sata node uses
> > 
> > phys = <&phyA 0>;
> > 
> > and the PCIe node uses
> > 
> > phys = <&phyB 1>;
> > 
> > Then the binding for the phy defines that an argument of '0' means sata 
> > mode,
> > while '1' means pcie mode, plus you should define all other valid modes.

Probably, it may  not help in this case. How would *phys* defining as
above with PCIe/SATA node help phy driver to decide whether current
phy instance is associated with PCIe or SATA. Actually, there is no
way to pass information from phy consumer driver(pcie/sata driver in
this case) to phy driver.

> 
> Anyway phyA and phyB points to different nodes and just from phyA and phyB we
> should be able to tell whether it is sata or pcie.

We have multiple instances (say 3) of same phy, which can be
programmed either for pcie or for sata. We have multiple instances of
ahci and pcie controller. phy_n will be connected to either ahci_n or
pcie_n.

What Kishon has suggested here is exactly what I was thinking.
I think, we should go with this.

> 
> We can just have a property in phyA to specify it is SATA and phyB to specify
> it is PCIE.
> phyA {
>   compatible="phy-pipe3";
>   .
>   .
>   type=;
> }
> phyB {
>   compatible="phy-pipe3";
>   .
>   .
>   type=;
> }
> Then in probe
>   of_property_read_u32(node, "type", &pipe3->type);
> 
> In phy_init function we can follow different path for SATA and PCIE using the 
> type
> 
> static int pipe3_init(struct phy *x) {
>   struct pipe3 *phy = phy_get_drvdata(x);
> 
>   switch (phy->type) {
>   case SATA:
>   /* do sata phy initialization here*/
>   break;
>   case PCIE:
>   /* do pcie phy initialization here*/
>   break;
>   default:
>   dev_err(phy->dev, "phy type not supported\n");
>   }
> 
>   return 0;
> }
> 
> Cheers
> Kishon

Regards
Pratyush
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCHSET cgroup/for-3.15] cgroup: convert to kernfs

2014-01-29 Thread Li Zefan
This is finally done!

We'll have our most important vacation in China, so I won't be responsive
until next next Monday. I'll review those patches when I come back to work.

On 2014/1/29 7:54, Tejun Heo wrote:
> Hello,
> 
> cgroup filesystem code was derived from the original sysfs
> implementation which was heavily intertwined with vfs objects and
> locking with the goal of re-using the existing vfs infrastructure.
> That experiment turned out rather disastrous and sysfs switched, a
> long time ago, to distributed filesystem model where a separate
> representation is maintained which is queried by vfs.  Unfortunately,
> cgroup stuck with the failed experiment all these years and
> accumulated even more problems over time.
> 
> Locking and object lifetime management being entangled with vfs is
> probably the most egregious.  vfs was never designed to be misused
> like this and cgroup ends up jumping through various convoluted
> dancing to make things work.  Even then, operations across multiple
> cgroups can't be done safely as it'll deadlock with rename locking.
> 
> Recently, kernfs is separated out from sysfs so that it can be used by
> users other than sysfs.  This patchset converts cgroup to use kernfs.
> This simplifies code base quite a bit and allows further cleanups and
> implementation of features which depend on operating across multiple
> nodes.
> 
> This patchset contains the following 13 patches.
> 
>  0001-cgroup-improve-css_from_dir-into-css_tryget_from_dir.patch
>  0002-cgroup-introduce-cgroup_tree_mutex.patch
>  0003-cgroup-release-cgroup_mutex-over-file-removals.patch
>  0004-cgroup-restructure-locking-and-error-handling-in-cgr.patch
>  0005-cgroup-factor-out-cgroup_setup_root-from-cgroup_moun.patch
>  0006-cgroup-update-cgroup-name-handling.patch
>  0007-cgroup-make-cgroup_subsys-base_cftypes-use-cgroup_ad.patch
>  0008-cgroup-update-the-meaning-of-cftype-max_write_len.patch
>  0009-cgroup-introduce-cgroup_init-exit_cftypes.patch
>  0010-cgroup-introduce-cgroup_ino.patch
>  0011-cgroup-misc-preps-for-kernfs-conversion.patch
>  0012-cgroup-relocate-functions-in-preparation-of-kernfs-c.patch
>  0013-cgroup-convert-to-kernfs.patch
> 
> 0001 updates css_from_dir() into css_tryget_from_dir() so that the
> caller doesn't have to worry about RCU locking.
> 
> 0002-0004 introduce cgroup_tree_mutex and prepare locking.
> 
> 0005-0006 are misc preps.
> 
> 0007-0008 update cftype handling in preparation.
> 
> 0009-0012 are misc preps.
> 
> 0013 converts cgroup to kernfs.
> 
> This patchset is on top of
> 
>   linus#master 54c0a4b46150 ("Merge branch 'akpm' (incoming from Andrew)")
> + [1] [PATCHSET cgroup/for-3.14-fixes] cgroup: four misc fixes
> + [2] [PATCH] arm, pm, vmpressure: add missing slab.h includes
> + [3] [PATCHSET v2 cgroup/for-3.15] cgroup: drop module support and 
> cgroup_root_mutex
> + git://git.kernel.org/pub/scm/linux/kernel/git/tj/misc.git 
> review-kernfs-cgroup-prep
> 
> and also available in the following git branch.
> 
>  git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup.git 
> review-kernfs-conversion
> 
> diffstat follows.
> 
>  block/blk-throttle.c   |4
>  block/cfq-iosched.c|3
>  include/linux/cgroup.h |   71 --
>  kernel/cgroup.c| 1712 
> -
>  kernel/events/core.c   |   17
>  mm/memcontrol.c|   16
>  mm/memory-failure.c|8
>  7 files changed, 754 insertions(+), 1077 deletions(-)
> 


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] i2c-designware-pcidrv: fix the incorrect return of idle callback

2014-01-29 Thread xinhui.pan


于 2014年01月29日 16:35, Mika Westerberg 写道:
> On Tue, Jan 28, 2014 at 07:30:35PM +0100, Wolfram Sang wrote:
>> On Tue, Jan 28, 2014 at 01:48:28PM +0800, xinhui.pan wrote:
>>> From: "xinhui.pan" 
>>>
>>> i2c_dw_pci_runtime_idle should return -EBUSY rather than zero if it do 
>>> success.
>>
>> I don't understand...
>>
>>> Otherwise rpm_idle will call pm_suspend again and that may cause 
>>> pm_schedule_suspend delay invalidate.
>>> 
>>> Signed-off-by: bo.he 
>>> Signed-off-by: xinhui.pan 
>>> ---
>>>  drivers/i2c/busses/i2c-designware-pcidrv.c |4 ++--
>>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c 
>>> b/drivers/i2c/busses/i2c-designware-pcidrv.c
>>> index f6ed06c..96e81f6 100644
>>> --- a/drivers/i2c/busses/i2c-designware-pcidrv.c
>>> +++ b/drivers/i2c/busses/i2c-designware-pcidrv.c
>>> @@ -190,8 +190,8 @@ static int i2c_dw_pci_runtime_idle(struct device *dev)
>>> int err = pm_schedule_suspend(dev, 500);
>>> dev_dbg(dev, "runtime_idle called\n");
>>>  
>>> -   if (err != 0)
>>> -   return 0;
>>> +   if (err)
>>> +   return err;
>>> return -EBUSY;
>>
>> ... it does return EBUSY when pm_schedule_suspend() succeeds? It only
>> returns 0 if it does not succeed (for which I don't know if this is an
>> apropriate behaviour). Mika?
> 
> If I understand correctly, pm_schedule_suspend(dev, 500) is there because
> we want to runtime suspend in 500 ms. It then returns -EBUSY to prevent PM
> runtime from carrying on suspend on it's own. However, I have no idea where
> this magical 500 ms requirement comes from.
> 
> If we fail to schedule suspend we let the PM core to do whatever it thinks
> suitable (in this case I suppose it suspends the device).
> 

Hi ,Mika
  If the callback returns 0,it means pm_schedule_suspend fails,
also means rpm_check_suspend_allowed(pm_schedule_suspend calls it) 
returns nonzero value.As a result,rpm_suspend will be called by rpm_idle.
  However in rpm_idle, rpm_check_suspend_allowed is called at first,too.
and the return value is treated as it is.But rpm_idle just returns 
without doing anything(rpm_suspend is not called). 
  in both case above,why goes in different ways? I am confused.
 
> I think the whole idle dance could be replaced with a use of runtime PM
> autosuspend, just like we do in the platform version of the driver.
> 
> Xinghui,
> 
> Is this a real problem that you are trying to solve?
> 

To be honest,we got many panic when testing.
But is not caused by this driver I think.
while checking problems,we found these confusing codes by accident.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: linux-next: build failure after merge of the clk tree

2014-01-29 Thread Sebastian Hesselbarth

On 01/29/2014 04:32 AM, Stephen Rothwell wrote:

After merging the clk tree, today's linux-next build (x86_64 allmodconfig)
failed like this:

drivers/clk/clk-si5351.c: In function 'si5351_i2c_probe':
drivers/clk/clk-si5351.c:1314:2: error: too many arguments to function 
'si5351_dt_parse'
   ret = si5351_dt_parse(client, variant);
   ^
drivers/clk/clk-si5351.c:1296:12: note: declared here
  static int si5351_dt_parse(struct i2c_client *client)
 ^

Caused by commit 9d43dc7f403d ("clk: si5351: remove variant from
platform_data").

I have used the clk tree from next-20140128 for today.  (Yes, I know that
Linus already took this - I guess I won't have to worry about it
tomorrow.)


I wasn't aware that Mike did not sent his PR for v3.14 yet and that
Linus will pick it up that quickly. The patch had been lying around
for a while but was obviously not well compile tested.

Anyway, my patch, my fault: Thanks for fixing it up and sorry for the
inconvenience.

Sebastian

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH trivial] Documentation: fix multiple typo occurences s/KenelVersion/KernelVersion/

2014-01-29 Thread Ard Biesheuvel
Signed-off-by: Ard Biesheuvel 
Cc: Andrzej Pietrasiewicz 
---
 Documentation/ABI/testing/configfs-usb-gadget  | 12 ++--
 Documentation/ABI/testing/configfs-usb-gadget-acm  |  2 +-
 Documentation/ABI/testing/configfs-usb-gadget-ecm  |  2 +-
 Documentation/ABI/testing/configfs-usb-gadget-eem  |  2 +-
 Documentation/ABI/testing/configfs-usb-gadget-ffs  |  2 +-
 Documentation/ABI/testing/configfs-usb-gadget-loopback |  2 +-
 Documentation/ABI/testing/configfs-usb-gadget-mass-storage |  4 ++--
 Documentation/ABI/testing/configfs-usb-gadget-ncm  |  2 +-
 Documentation/ABI/testing/configfs-usb-gadget-obex |  2 +-
 Documentation/ABI/testing/configfs-usb-gadget-phonet   |  2 +-
 Documentation/ABI/testing/configfs-usb-gadget-rndis|  2 +-
 Documentation/ABI/testing/configfs-usb-gadget-serial   |  2 +-
 Documentation/ABI/testing/configfs-usb-gadget-sourcesink   |  2 +-
 Documentation/ABI/testing/configfs-usb-gadget-subset   |  2 +-
 14 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/Documentation/ABI/testing/configfs-usb-gadget 
b/Documentation/ABI/testing/configfs-usb-gadget
index 01e769d6984d..37559a06393b 100644
--- a/Documentation/ABI/testing/configfs-usb-gadget
+++ b/Documentation/ABI/testing/configfs-usb-gadget
@@ -1,13 +1,13 @@
 What:  /config/usb-gadget
 Date:  Jun 2013
-KenelVersion:  3.11
+KernelVersion: 3.11
 Description:
This group contains sub-groups corresponding to created
USB gadgets.
 
 What:  /config/usb-gadget/gadget
 Date:  Jun 2013
-KenelVersion:  3.11
+KernelVersion: 3.11
 Description:
 
The attributes of a gadget:
@@ -27,7 +27,7 @@ Description:
 
 What:  /config/usb-gadget/gadget/configs
 Date:  Jun 2013
-KenelVersion:  3.11
+KernelVersion: 3.11
 Description:
This group contains a USB gadget's configurations
 
@@ -58,20 +58,20 @@ Description:
 
 What:  /config/usb-gadget/gadget/functions
 Date:  Jun 2013
-KenelVersion:  3.11
+KernelVersion: 3.11
 Description:
This group contains functions available to this USB gadget.
 
 What:  /config/usb-gadget/gadget/strings
 Date:  Jun 2013
-KenelVersion:  3.11
+KernelVersion: 3.11
 Description:
This group contains subdirectories for language-specific
strings for this gadget.
 
 What:  /config/usb-gadget/gadget/strings/language
 Date:  Jun 2013
-KenelVersion:  3.11
+KernelVersion: 3.11
 Description:
The attributes:
 
diff --git a/Documentation/ABI/testing/configfs-usb-gadget-acm 
b/Documentation/ABI/testing/configfs-usb-gadget-acm
index 5708a568b5f6..d21092d75a05 100644
--- a/Documentation/ABI/testing/configfs-usb-gadget-acm
+++ b/Documentation/ABI/testing/configfs-usb-gadget-acm
@@ -1,6 +1,6 @@
 What:  /config/usb-gadget/gadget/functions/acm.name
 Date:  Jun 2013
-KenelVersion:  3.11
+KernelVersion: 3.11
 Description:
 
This item contains just one readonly attribute: port_num.
diff --git a/Documentation/ABI/testing/configfs-usb-gadget-ecm 
b/Documentation/ABI/testing/configfs-usb-gadget-ecm
index 6b9a582ce0b5..0addf7704b4c 100644
--- a/Documentation/ABI/testing/configfs-usb-gadget-ecm
+++ b/Documentation/ABI/testing/configfs-usb-gadget-ecm
@@ -1,6 +1,6 @@
 What:  /config/usb-gadget/gadget/functions/ecm.name
 Date:  Jun 2013
-KenelVersion:  3.11
+KernelVersion: 3.11
 Description:
The attributes:
 
diff --git a/Documentation/ABI/testing/configfs-usb-gadget-eem 
b/Documentation/ABI/testing/configfs-usb-gadget-eem
index dbddf36b48b3..a4c57158fcde 100644
--- a/Documentation/ABI/testing/configfs-usb-gadget-eem
+++ b/Documentation/ABI/testing/configfs-usb-gadget-eem
@@ -1,6 +1,6 @@
 What:  /config/usb-gadget/gadget/functions/eem.name
 Date:  Jun 2013
-KenelVersion:  3.11
+KernelVersion: 3.11
 Description:
The attributes:
 
diff --git a/Documentation/ABI/testing/configfs-usb-gadget-ffs 
b/Documentation/ABI/testing/configfs-usb-gadget-ffs
index 14343e237e83..e39b27653c65 100644
--- a/Documentation/ABI/testing/configfs-usb-gadget-ffs
+++ b/Documentation/ABI/testing/configfs-usb-gadget-ffs
@@ -1,6 +1,6 @@
 What:  /config/usb-gadget/gadget/functions/ffs.name
 Date:  Nov 2013
-KenelVersion:  3.13
+KernelVersion: 3.13
 Description:   The purpose of this directory is to create and remove it.
 
A corresponding USB function instance is created/removed.
diff --git a/Documentation/ABI/testing/configfs-usb-gadget-loopback 
b/Documentation/ABI/testing/configfs-usb-gadget-loopback
index 852b2365a5b5..9aae5bfb9908 100644
--- a/Documentation/ABI/testing/configfs-usb-gadget-loopback
+++ b/Documentation/ABI/testing/configfs-usb-gadget-loopback
@@ -1,6 +1,6 @@
 What:  /config/usb-gadget/gadget/functions/Loopback.name
 Date:  

Re: [PATCH 3/4] mtd: block2mtd: check device size

2014-01-29 Thread Ezequiel Garcia
Hi Fabian,

I saw you sent a v2 for one of the patches on this series,
but maybe this is worth considering too.

On Thu, Jan 23, 2014 at 08:53:31PM +0100, Fabian Frederick wrote:
[..]
> -/* FIXME: ensure that mtd->size % erase_size == 0 */
>  static struct block2mtd_dev *add_device(char *devname, int erase_size)
>  {
>   const fmode_t mode = FMODE_READ | FMODE_WRITE | FMODE_EXCL;
> @@ -250,6 +249,11 @@ static struct block2mtd_dev *add_device(char *devname, 
> int erase_size)
>   goto devinit_err1;
>   }
>  
> + if ((long)dev->blkdev->bd_inode->i_size % erase_size) {
> + pr_err("erasesize muse be a divisor of device size\n");
> + goto devinit_err1;
> + }
> +

Brian: What do you think?

Fabian: Have you tested this patch? Can you elaborate a bit more about
the effect it would have, compared to the current behavior?
-- 
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 05/18] mfd: max14577: Use of_match_ptr() in i2c_driver

2014-01-29 Thread Krzysztof Kozlowski
I would like to drop this patch.

It does not make sense as "max14577_dt_match" is always compiled and
of_match_ptr was removed on purpose by Sachin Kamat (ae679c12e8; mfd:
max14577: Remove redundant of_match_ptr helper).

Best regards,
Krzysztof Kozlowski


On Tue, 2014-01-28 at 13:18 +0100, Krzysztof Kozlowski wrote:
> Use of_match_ptr() in assignment of i2c_driver.of_match_table.
> 
> Signed-off-by: Krzysztof Kozlowski 
> Cc: Kyungmin Park 
> Cc: Marek Szyprowski 
> ---
>  drivers/mfd/max14577.c |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mfd/max14577.c b/drivers/mfd/max14577.c
> index 2ac2f2d7cea6..75b37082a3fe 100644
> --- a/drivers/mfd/max14577.c
> +++ b/drivers/mfd/max14577.c
> @@ -224,7 +224,7 @@ static struct i2c_driver max14577_i2c_driver = {
>   .name = "max14577",
>   .owner = THIS_MODULE,
>   .pm = &max14577_pm,
> - .of_match_table = max14577_dt_match,
> + .of_match_table = of_match_ptr(max14577_dt_match),
>   },
>   .probe = max14577_i2c_probe,
>   .remove = max14577_i2c_remove,

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] mfd: include all drivers in subsystem menu

2014-01-29 Thread Linus Walleij
It is currently not possible to select the SA1100 or Vexpress
drivers in the MFD subsystem, because the menu for the entire
subsystem ends before these options are presented.

Move the main menu closing and the endif for HAS_IOMEM to the
end of the file so these are selectable again.

Cc: sta...@vger.kernel.org
Cc: Andrea Adami 
Cc: Dmitry Eremin-Solenikov 
Signed-off-by: Linus Walleij 
---
 drivers/mfd/Kconfig | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 49bb445d846a..17004a61fdd5 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -1193,9 +1193,6 @@ config MFD_STW481X
  in various ST Microelectronics and ST-Ericsson embedded
  Nomadik series.
 
-endmenu
-endif
-
 menu "Multimedia Capabilities Port drivers"
depends on ARCH_SA1100
 
@@ -1226,3 +1223,6 @@ config VEXPRESS_CONFIG
help
  Platform configuration infrastructure for the ARM Ltd.
  Versatile Express.
+
+endmenu
+endif
-- 
1.8.5.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC PATCH 0/9] mtd: nand: add sunxi NAND Flash Controller support

2014-01-29 Thread boris brezillon

Hello Rob,

On 23/01/2014 16:22, Rob Herring wrote:

On Sat, Jan 11, 2014 at 7:38 AM, boris brezillon
 wrote:

On 08/01/2014 15:21, Boris BREZILLON wrote:

Hello,

This series add the sunxi NFC support with up to 8 NAND chip connected.
I'm still in the early stages drivers development and some key features
are
missing, but it's usable (I tested it on the cubietruck board).

Here's what's missing:
   - HW ECC support
   - DMA support
   - HW randomization support
   - many more improvements

This series depends on Emilio's patch series implementing mod0 clks

(http://lists.infradead.org/pipermail/linux-arm-kernel/2013-July/185478.html)
+ an other patch not yet posted

(http://git.elopez.com.ar/linux/commits/5b4eb3ac406b9c98965714d40e8dd6da943d1ab0)


During my reasearch regarding the HW ECC and HW randomizer of the Allwinner
NAND flash controller I found this document describing the Altera NAND flash
controller
(which is in turn based on a cadence IP):

Which may be similar to drivers/mtd/nand/denali.c as Cadence bought Denali?

Actually I was wrong, the sunxi and the cadence IP have nothing in common.
This was pointed out by Henrik (see this thread :
https://groups.google.com/forum/#!searchin/linux-sunxi/nand/linux-sunxi/x69tFBi95Zk/bNyJlWWOV8oJ 
).



Sorry for the false hopes.

Best Regards,

Boris



Rob


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH RESEND 1/4] clk: clk-s2mps11: Refactor for including support for other MFD clocks

2014-01-29 Thread Krzysztof Kozlowski
Hi,

> 
> Quoting Mark Brown (2013-12-31 08:09:16)
> > On Mon, Dec 30, 2013 at 09:33:50AM +0530, Tushar Behera wrote:
> > 
> > > Commit 1b1ccee1e821 "mfd: s2mps11: Fix build after regmap field rename
> > > in sec-core.c" is also touching this file, which is in Mark's tree
> > > right now. If I rebase
> > 
> > It's been in Linus' tree for a while now.
> 
> OK, so I merged the two patches into clk-next, then merged clk-next into
> next-20131224 and the merge is super trivial to resolve. So I propose
> that we just let it get resolved in linux-next the usual way.
> 
> Any objections? If not I'll take these two patches into clk-next.

Did you merged these patches into clk-next? Unfortunately I couldn't
find them (clk-next, next).

I am asking because I want to send patches with support for S2MPS14
clock (based on these patches).

Best regards,
Krzysztof


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] i2c-designware-pcidrv: fix the incorrect return of idle callback

2014-01-29 Thread Mika Westerberg
On Wed, Jan 29, 2014 at 06:00:26PM +0800, xinhui.pan wrote:
> 
> 
> 于 2014年01月29日 16:35, Mika Westerberg 写道:
> > On Tue, Jan 28, 2014 at 07:30:35PM +0100, Wolfram Sang wrote:
> >> On Tue, Jan 28, 2014 at 01:48:28PM +0800, xinhui.pan wrote:
> >>> From: "xinhui.pan" 
> >>>
> >>> i2c_dw_pci_runtime_idle should return -EBUSY rather than zero if it do 
> >>> success.
> >>
> >> I don't understand...
> >>
> >>> Otherwise rpm_idle will call pm_suspend again and that may cause 
> >>> pm_schedule_suspend delay invalidate.
> >>>   
> >>> Signed-off-by: bo.he 
> >>> Signed-off-by: xinhui.pan 
> >>> ---
> >>>  drivers/i2c/busses/i2c-designware-pcidrv.c |4 ++--
> >>>  1 file changed, 2 insertions(+), 2 deletions(-)
> >>>
> >>> diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c 
> >>> b/drivers/i2c/busses/i2c-designware-pcidrv.c
> >>> index f6ed06c..96e81f6 100644
> >>> --- a/drivers/i2c/busses/i2c-designware-pcidrv.c
> >>> +++ b/drivers/i2c/busses/i2c-designware-pcidrv.c
> >>> @@ -190,8 +190,8 @@ static int i2c_dw_pci_runtime_idle(struct device *dev)
> >>>   int err = pm_schedule_suspend(dev, 500);
> >>>   dev_dbg(dev, "runtime_idle called\n");
> >>>  
> >>> - if (err != 0)
> >>> - return 0;
> >>> + if (err)
> >>> + return err;
> >>>   return -EBUSY;
> >>
> >> ... it does return EBUSY when pm_schedule_suspend() succeeds? It only
> >> returns 0 if it does not succeed (for which I don't know if this is an
> >> apropriate behaviour). Mika?
> > 
> > If I understand correctly, pm_schedule_suspend(dev, 500) is there because
> > we want to runtime suspend in 500 ms. It then returns -EBUSY to prevent PM
> > runtime from carrying on suspend on it's own. However, I have no idea where
> > this magical 500 ms requirement comes from.
> > 
> > If we fail to schedule suspend we let the PM core to do whatever it thinks
> > suitable (in this case I suppose it suspends the device).
> > 
> 
> Hi ,Mika
>   If the callback returns 0,it means pm_schedule_suspend fails,
> also means rpm_check_suspend_allowed(pm_schedule_suspend calls it) 
> returns nonzero value.As a result,rpm_suspend will be called by rpm_idle.
>   However in rpm_idle, rpm_check_suspend_allowed is called at first,too.
> and the return value is treated as it is.But rpm_idle just returns 
> without doing anything(rpm_suspend is not called). 
>   in both case above,why goes in different ways? I am confused.

To be honest, I don't know ;-)

> > I think the whole idle dance could be replaced with a use of runtime PM
> > autosuspend, just like we do in the platform version of the driver.
> > 
> > Xinghui,
> > 
> > Is this a real problem that you are trying to solve?
> > 
> 
> To be honest,we got many panic when testing.
> But is not caused by this driver I think.
> while checking problems,we found these confusing codes by accident.

OK, so if this is not a problem, I would suggest keeping the code as is for
now as someone who introduced the pm_schedule_suspend() thing probably
tested it and it worked then.

In fact, I think that the PCI part of that driver needs an audit since it
does some PCI power management magic itself which drivers aren't supposed
to do anymore.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ipv6: default route for link local address is not added while assigning a address

2014-01-29 Thread Nicolas Dichtel

Le 29/01/2014 07:41, Sohny Thomas a écrit :

Resending this on netdev mailing list:
Default route for link local address is configured automatically if
NETWORKING_IPV6=yes is in ifcfg-eth*.
When the route table for the interface is flushed and a new address is added to
the same device with out removing linklocal addr, default route for link local
address has to added by default.

I have found the issue to be caused by this checkin

http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/net/ipv6?id=62b54dd91567686a1cb118f76a72d5f4764a86dd


According to this change :
He removes adding a link local route if any other address is added , applicable
across all interfaces though there's mentioned only lo interface
So below patch fixes for other devices

Signed-off-by: Sohny THomas 

Your email client has corrupted the patch, it cannot be applied.
Please read Documentation/email-clients.txt

About the patch, I still think that the flush is too agressive. Link local
routes are marked as 'proto kernel', removing them without the link local
address is wrong.

With this patch, you will add a link local route even if you don't have a link
local address.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [GIT PULL] x86/kaslr for v3.14

2014-01-29 Thread Borislav Petkov
On Wed, Jan 29, 2014 at 09:25:05AM +0100, Ingo Molnar wrote:
> That would default to Y and would disable debuginfo by default.
>
> ( And yeah, it's a bit ugly, but it beats having to hack the kconfig
> language! )

Yeah, that could be another solution - I came up with another hack last
night: http://marc.info/?l=linux-kernel&m=139095226124549

-- 
Regards/Gruss,
Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: BUG: spinlock lockup

2014-01-29 Thread naveen yadav
Dear Will,


Thanks for your input. We debug by adding print as below and found
very big value difference between next and owner(more then 1000). So
it seams memory corruption.



linux/lib/spinlock_debug.c

msg, raw_smp_processor_id(),
current->comm, task_pid_nr(current));
printk(KERN_EMERG " lock: %pS, .magic: %08x, .owner: %s/%d, "
-   ".owner_cpu: %d\n",
+   ".owner_cpu: %d raw_lock.tickets.next %u raw_lock.tickets.owner 
%u \n",
lock, lock->magic,
owner ? owner->comm : "",
owner ? task_pid_nr(owner) : -1,
-   lock->owner_cpu);
+   lock->owner_cpu,
+   lock->raw_lock.tickets.next,
+   lock->raw_lock.tickets.owner);
dump_stack();
 }


I have one request, is it possible to change like below, if any
corruption, it is easy to debug .
if magic is corrupt, we can find quickly.

typedef struct raw_spinlock {

#ifdef CONFIG_DEBUG_SPINLOCK
unsigned int magic, owner_cpu;
void *owner;
#endif

arch_spinlock_t raw_lock;
#ifdef CONFIG_GENERIC_LOCKBREAK
unsigned int break_lock;
#endif
#ifdef CONFIG_DEBUG_LOCK_ALLOC
struct lockdep_map dep_map;
#endif
} raw_spinlock_t;

So if this structure got corrupt,
On Tue, Jan 21, 2014 at 3:44 PM, Will Deacon  wrote:
> On Tue, Jan 21, 2014 at 06:37:31AM +, naveen yadav wrote:
>> Thanks for your reply,
>>
>> We are using Cortex A15.
>> yes,  this is with ticket lock.
>>
>> We will check value of arch_spinlock_t and share it. It is bit
>> difficult to reproduce this scenario.
>>
>> If you have some idea ,please suggest how to reproduce it.
>
> You could try enabling lockdep and see if it catches anything earlier
> on.
>
> Will
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 6/8] cgroup: remove cgroup->name

2014-01-29 Thread Peter Zijlstra
On Tue, Jan 28, 2014 at 06:59:43PM -0500, Tejun Heo wrote:
> cgroup->name handling became quite complicated over time involving
> dedicated struct cgroup_name for RCU protection.  Now that cgroup is
> on kernfs, we can drop all of it and simply use kernfs_name/path() and
> friends.  Replace cgroup->name and all related code with kernfs
> name/path constructs.
> 
> * Reimplement cgroup_name() and cgroup_path() as thin wrappers on top
>   of kernfs counterparts, which involves semantic changes.
>   pr_cont_cgroup_name() and pr_cont_cgroup_path() added.
> 
> * cgroup->name handling dropped from cgroup_rename().
> 
> * All users of cgroup_name/path() updated to the new semantics.  Users
>   which were formatting the string just to printk them are converted
>   to use pr_cont_cgroup_name/path() instead, which simplifies things
>   quite a bit.  As cgroup_name() no longer requires RCU read lock
>   around it, RCU lockings which were protecting only cgroup_name() are
>   removed.
> 
> Signed-off-by: Tejun Heo 
> Cc: Li Zefan 
> Cc: Ingo Molnar 
> Cc: Johannes Weiner 
> Cc: Michal Hocko 
> Cc: Balbir Singh 
> Cc: KAMEZAWA Hiroyuki 

Acked-by: Peter Zijlstra 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 3/6] cgroup: clean up cgroup_subsys names and initialization

2014-01-29 Thread Peter Zijlstra
On Tue, Jan 28, 2014 at 06:43:58PM -0500, Tejun Heo wrote:
> * With the above, renaming subsys identifiers to match the userland
>   visible names doesn't cause any naming conflicts.  All non-matching
>   identifiers are renamed to match the official names.
> 
>   cpu_cgroup -> cpu
>   perf -> perf_event
> 
> Cc: Ingo Molnar 
Acked-by: Peter Zijlstra 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC PATCH 1/9] mtd: nand: retrieve ECC requirements from Hynix READ ID byte 4

2014-01-29 Thread boris brezillon

Hello Brian,

On 23/01/2014 02:49, Brian Norris wrote:

+ Huang

Hi Boris,

On Wed, Jan 08, 2014 at 03:21:56PM +0100, Boris BREZILLON wrote:

The Hynix nand flashes store their ECC requirements in byte 4 of its id
(returned on READ ID command).

Signed-off-by: Boris BREZILLON 

I haven't verified yet (perhaps Huang can confirm?), but this may be
similar to a patch Huang submitted recently. In his case, we found that
this table is actually quite unreliable and is likely hard to maintain.


You mean these bytes are not reliable within the whole Hynix LP (Large Page)
NAND product line ?



Why do you need this ECC information, for my reference?


Because the NAND flash available on the cubietruck board does not 
support the
ONFI standard, and I thought this could be a option to retrieve the ECC 
strength

requirements.

Anyway, I added a new helper function to retrieve ecc informations from 
device
tree (I'll post it in the 2nd version of this series). We'll see if this 
approach is

accepted...



Brian


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3] ARM: hw_breakpoint: Add ARMv8 support

2014-01-29 Thread Will Deacon
Hi Christopher,

On Tue, Jan 28, 2014 at 06:51:51PM +, Christopher Covington wrote:
> Add the trivial support necessary to get hardware breakpoints
> working for GDB on ARMv8 simulators running in AArch32 mode.
> 
> Acked-by: Will Deacon 
> Signed-off-by: Christopher Covington 
> ---
> 
>  v3: assume for now that ARMv9 and later will update FSR

Please can you stick this into the patch system? I don't have any other
hw_breakpoint changes queued, so I doubt I'll send a pull for 3.15.

Cheers,

Will
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 0/2] [BUG FIXES - 3.10.27] sit: More backports

2014-01-29 Thread Nicolas Dichtel

Le 28/01/2014 21:57, Steven Rostedt a écrit :

At Red Hat we base our real-time kernel off of 3.10.27 and do lots of
stress testing on that kernel. This has discovered some bugs that we
can hit with the vanilla 3.10.27 kernel (no -rt patches applied).

I sent out a bug fix that can cause a crash with the current 3.10.27
when you add and then remove the sit module. That patch is obsoleted by
these patches, as that patch was not enough.

Can you explain a bit more which problem remains after that patch?
I wonder if a problem remains also with ip6_tunnel.ko (net/ipv6/ip6_tunnel.c),
the same problem was spotted into this module.



A previous patch that was backported:

   Upstream commit 205983c43700ac3a81e7625273a3fa83cd2759b5
   sit: allow to use rtnl ops on fb tunnel

Had a depenency on commit 5e6700b3bf98 ("sit: add support of x-netns")
which was not backported. The dependency was only on part of that
commit which is what I backported.

I cannot comment directly the patch, it was an attachement, hence I put my
comments here.
In patch 0001-sit-Unregister-sit-devices-with-rtnl_link_ops.patch, I wonder how
'if (dev_net(t->dev) != net)' can be wrong. If commit 5e6700b3bf98 ("sit: add
support of x-netns") has not been backported, this test is always true.



The other upstream commit 9434266f2c645d4fcf62a03a8e36ad8075e37943
sit: fix use after free of fb_tunnel_dev

fixes another bug we encountered, it also fixes the 3.10.27 bug
where removing the sit module cause the crash. This is the patch
that obsoletes my previous patch.

-- Steve


Steven Rostedt (Red Hat) (1):
   sit: Unregister sit devices with rtnl_link_ops

Willem de Bruijn (1):
   sit: fix use after free of fb_tunnel_dev


  net/ipv6/sit.c | 30 +-
  1 file changed, 25 insertions(+), 5 deletions(-)


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH V3 1/2] devres: introduce API "devm_kstrdup"

2014-01-29 Thread Manish Badarkhe
Hi Joe,

Thank you for your review.

On Wed, Jan 29, 2014 at 9:48 AM, Joe Perches  wrote:
> On Wed, 2014-01-29 at 09:33 +0530, Manish Badarkhe wrote:
>> This patch introduces "devm_kstrdup" API so that the
>> device's driver can allocate memory and copy string.
> []
>> diff --git a/drivers/base/devres.c b/drivers/base/devres.c
> []
>> @@ -791,6 +791,32 @@ void * devm_kmalloc(struct device *dev, size_t size, 
>> gfp_t gfp)
>>  EXPORT_SYMBOL_GPL(devm_kmalloc);
>>
>>  /**
>> + * devm_kstrdup - Allocate resource managed space and
>> + *and copy an existing string
>> + * @dev: Device to allocate memory for
>> + * @s: the string to duplicate
>> + * @size: Allocation size
>
> Why is size necessary at all?
> I think it should be calculated by strlen

I thought of avoiding string length calculation in function.
But,yes its better to do it in function to avoid extra parsing
of argument to function.Will update code and
post a patch.

>> +char *devm_kstrdup(struct device *dev,
>> +const char *s, size_t size, gfp_t gfp)
>> +{
>> + char *buf;
>> +
>> + if (!s)
>> + return NULL;
>> +
>> + buf = devm_kzalloc(dev, size, gfp);
>
> If this is really necessary, please use devm_kmalloc

devm_kzalloc is always better giving zeroed memory locations.
Is there any reason not to go for it?

Regards
Manish Badarkhe
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 2/5] ARM: sun6i: dt: Add PLL6 and SPI module clocks

2014-01-29 Thread Maxime Ripard
The module clocks in the A31 are still compatible with the A10 one. Add the SPI
module clocks and the PLL6 in the device tree to allow their use by the SPI
controllers.

Signed-off-by: Maxime Ripard 
---
 arch/arm/boot/dts/sun6i-a31.dtsi | 46 
 1 file changed, 37 insertions(+), 9 deletions(-)

diff --git a/arch/arm/boot/dts/sun6i-a31.dtsi b/arch/arm/boot/dts/sun6i-a31.dtsi
index 5256ad9..0eea325 100644
--- a/arch/arm/boot/dts/sun6i-a31.dtsi
+++ b/arch/arm/boot/dts/sun6i-a31.dtsi
@@ -73,16 +73,12 @@
clocks = <&osc24M>;
};
 
-   /*
-* This is a dummy clock, to be used as placeholder on
-* other mux clocks when a specific parent clock is not
-* yet implemented. It should be dropped when the driver
-* is complete.
-*/
-   pll6: pll6 {
+   pll6: clk@01c20028 {
#clock-cells = <0>;
-   compatible = "fixed-clock";
-   clock-frequency = <0>;
+   compatible = "allwinner,sun6i-a31-pll6-clk";
+   reg = <0x01c20028 0x4>;
+   clocks = <&osc24M>;
+   clock-output-names = "pll6";
};
 
cpu: cpu@01c20050 {
@@ -182,6 +178,38 @@
"apb2_uart1", "apb2_uart2", 
"apb2_uart3",
"apb2_uart4", "apb2_uart5";
};
+
+   spi0_clk: clk@01c200a0 {
+   #clock-cells = <0>;
+   compatible = "allwinner,sun4i-mod0-clk";
+   reg = <0x01c200a0 0x4>;
+   clocks = <&osc24M>, <&pll6>;
+   clock-output-names = "spi0";
+   };
+
+   spi1_clk: clk@01c200a4 {
+   #clock-cells = <0>;
+   compatible = "allwinner,sun4i-mod0-clk";
+   reg = <0x01c200a4 0x4>;
+   clocks = <&osc24M>, <&pll6>;
+   clock-output-names = "spi1";
+   };
+
+   spi2_clk: clk@01c200a8 {
+   #clock-cells = <0>;
+   compatible = "allwinner,sun4i-mod0-clk";
+   reg = <0x01c200a8 0x4>;
+   clocks = <&osc24M>, <&pll6>;
+   clock-output-names = "spi2";
+   };
+
+   spi3_clk: clk@01c200ac {
+   #clock-cells = <0>;
+   compatible = "allwinner,sun4i-mod0-clk";
+   reg = <0x01c200ac 0x4>;
+   clocks = <&osc24M>, <&pll6>;
+   clock-output-names = "spi3";
+   };
};
 
soc@01c0 {
-- 
1.8.4.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 1/5] clk: sunxi: Add support for PLL6 on the A31

2014-01-29 Thread Maxime Ripard
The A31 has a slightly different PLL6 clock. Add support for this new clock in
our driver.

Signed-off-by: Maxime Ripard 
---
 Documentation/devicetree/bindings/clock/sunxi.txt |  1 +
 drivers/clk/sunxi/clk-sunxi.c | 45 +++
 2 files changed, 46 insertions(+)

diff --git a/Documentation/devicetree/bindings/clock/sunxi.txt 
b/Documentation/devicetree/bindings/clock/sunxi.txt
index c2cb762..954845c 100644
--- a/Documentation/devicetree/bindings/clock/sunxi.txt
+++ b/Documentation/devicetree/bindings/clock/sunxi.txt
@@ -11,6 +11,7 @@ Required properties:
"allwinner,sun6i-a31-pll1-clk" - for the main PLL clock on A31
"allwinner,sun4i-pll5-clk" - for the PLL5 clock
"allwinner,sun4i-pll6-clk" - for the PLL6 clock
+   "allwinner,sun6i-a31-pll6-clk" - for the PLL6 clock on A31
"allwinner,sun4i-cpu-clk" - for the CPU multiplexer clock
"allwinner,sun4i-axi-clk" - for the AXI clock
"allwinner,sun4i-axi-gates-clk" - for the AXI gates
diff --git a/drivers/clk/sunxi/clk-sunxi.c b/drivers/clk/sunxi/clk-sunxi.c
index 659e4ea..990ad5d 100644
--- a/drivers/clk/sunxi/clk-sunxi.c
+++ b/drivers/clk/sunxi/clk-sunxi.c
@@ -249,7 +249,38 @@ static void sun4i_get_pll5_factors(u32 *freq, u32 
parent_rate,
*n = DIV_ROUND_UP(div, (*k+1));
 }
 
+/**
+ * sun6i_a31_get_pll6_factors() - calculates n, k factors for A31 PLL6
+ * PLL6 rate is calculated as follows
+ * rate = parent_rate * n * (k + 1) / 2
+ * parent_rate is always 24Mhz
+ */
+
+static void sun6i_a31_get_pll6_factors(u32 *freq, u32 parent_rate,
+  u8 *n, u8 *k, u8 *m, u8 *p)
+{
+   u8 div;
+
+   /*
+* We always have 24MHz / 2, so we can just say that our
+* parent clock is 12MHz.
+*/
+   parent_rate = parent_rate / 2;
+
+   /* Normalize value to a parent_rate multiple (24M / 2) */
+   div = *freq / parent_rate;
+   *freq = parent_rate * div;
+
+   /* we were called to round the frequency, we can now return */
+   if (n == NULL)
+   return;
+
+   *k = div / 32;
+   if (*k > 3)
+   *k = 3;
 
+   *n = DIV_ROUND_UP(div, (*k+1));
+}
 
 /**
  * sun4i_get_apb1_factors() - calculates m, p factors for APB1
@@ -416,6 +447,13 @@ static struct clk_factors_config sun4i_pll5_config = {
.kwidth = 2,
 };
 
+static struct clk_factors_config sun6i_a31_pll6_config = {
+   .nshift = 8,
+   .nwidth = 5,
+   .kshift = 4,
+   .kwidth = 2,
+};
+
 static struct clk_factors_config sun4i_apb1_config = {
.mshift = 0,
.mwidth = 5,
@@ -457,6 +495,12 @@ static const struct factors_data sun4i_pll5_data 
__initconst = {
.getter = sun4i_get_pll5_factors,
 };
 
+static const struct factors_data sun6i_a31_pll6_data __initconst = {
+   .enable = 31,
+   .table = &sun6i_a31_pll6_config,
+   .getter = sun6i_a31_get_pll6_factors,
+};
+
 static const struct factors_data sun4i_apb1_data __initconst = {
.table = &sun4i_apb1_config,
.getter = sun4i_get_apb1_factors,
@@ -972,6 +1016,7 @@ free_clkdata:
 static const struct of_device_id clk_factors_match[] __initconst = {
{.compatible = "allwinner,sun4i-pll1-clk", .data = &sun4i_pll1_data,},
{.compatible = "allwinner,sun6i-a31-pll1-clk", .data = 
&sun6i_a31_pll1_data,},
+   {.compatible = "allwinner,sun6i-a31-pll6-clk", .data = 
&sun6i_a31_pll6_data,},
{.compatible = "allwinner,sun4i-apb1-clk", .data = &sun4i_apb1_data,},
{.compatible = "allwinner,sun4i-mod0-clk", .data = &sun4i_mod0_data,},
{.compatible = "allwinner,sun7i-a20-out-clk", .data = 
&sun7i_a20_out_data,},
-- 
1.8.4.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 3/5] spi: sunxi: Add Allwinner A31 SPI controller driver

2014-01-29 Thread Maxime Ripard
The Allwinner A31 has a new SPI controller IP compared to the older Allwinner
SoCs.

It supports DMA, but the driver only does PIO for now, and DMA will be
supported eventually.

Signed-off-by: Maxime Ripard 
---
 .../devicetree/bindings/spi/spi-sun6i.txt  |  24 ++
 drivers/spi/Kconfig|   7 +
 drivers/spi/Makefile   |   1 +
 drivers/spi/spi-sun6i.c| 478 +
 4 files changed, 510 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/spi/spi-sun6i.txt
 create mode 100644 drivers/spi/spi-sun6i.c

diff --git a/Documentation/devicetree/bindings/spi/spi-sun6i.txt 
b/Documentation/devicetree/bindings/spi/spi-sun6i.txt
new file mode 100644
index 000..21de73d
--- /dev/null
+++ b/Documentation/devicetree/bindings/spi/spi-sun6i.txt
@@ -0,0 +1,24 @@
+Allwinner A31 SPI controller
+
+Required properties:
+- compatible: Should be "allwinner,sun6i-a31-spi".
+- reg: Should contain register location and length.
+- interrupts: Should contain interrupt.
+- clocks: phandle to the clocks feeding the SPI controller. Two are
+  needed:
+  - "ahb": the gated AHB parent clock
+  - "mod": the parent module clock
+- clock-names: Must contain the clock names described just above
+- resets: phandle to the reset controller asserting this device in
+  reset
+
+Example:
+
+spi1: spi@01c69000 {
+   compatible = "allwinner,sun6i-a31-spi";
+   reg = <0x01c69000 0x1000>;
+   interrupts = <0 66 4>;
+   clocks = <&ahb1_gates 21>, <&spi1_clk>;
+   clock-names = "ahb", "mod";
+   resets = <&ahb1_rst 21>;
+};
diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index eb1f1ef..004e3b0 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -438,6 +438,13 @@ config SPI_SIRF
help
  SPI driver for CSR SiRFprimaII SoCs
 
+config SPI_SUN6I
+   tristate "Allwinner A31 SPI controller"
+   depends on ARCH_SUNXI || COMPILE_TEST
+   select PM_RUNTIME
+   help
+ This enables using the SPI controller on the Allwinner A31 SoCs.
+
 config SPI_MXS
tristate "Freescale MXS SPI controller"
depends on ARCH_MXS
diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
index ab8d864..658ec64 100644
--- a/drivers/spi/Makefile
+++ b/drivers/spi/Makefile
@@ -69,6 +69,7 @@ obj-$(CONFIG_SPI_SH_HSPI) += spi-sh-hspi.o
 obj-$(CONFIG_SPI_SH_MSIOF) += spi-sh-msiof.o
 obj-$(CONFIG_SPI_SH_SCI)   += spi-sh-sci.o
 obj-$(CONFIG_SPI_SIRF) += spi-sirf.o
+obj-$(CONFIG_SPI_SUN6I)+= spi-sun6i.o
 obj-$(CONFIG_SPI_TEGRA114) += spi-tegra114.o
 obj-$(CONFIG_SPI_TEGRA20_SFLASH)   += spi-tegra20-sflash.o
 obj-$(CONFIG_SPI_TEGRA20_SLINK)+= spi-tegra20-slink.o
diff --git a/drivers/spi/spi-sun6i.c b/drivers/spi/spi-sun6i.c
new file mode 100644
index 000..32f3fc7
--- /dev/null
+++ b/drivers/spi/spi-sun6i.c
@@ -0,0 +1,478 @@
+/*
+ * Copyright (C) 2012 - 2014 Allwinner Tech
+ * Pan Nan 
+ *
+ * Copyright (C) 2014 Maxime Ripard
+ * Maxime Ripard 
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#define SUN6I_FIFO_DEPTH   128
+
+#define SUN6I_GBL_CTL_REG  0x04
+#define SUN6I_GBL_CTL_BUS_ENABLE   BIT(0)
+#define SUN6I_GBL_CTL_MASTER   BIT(1)
+#define SUN6I_GBL_CTL_TP   BIT(7)
+#define SUN6I_GBL_CTL_RST  BIT(31)
+
+#define SUN6I_TFR_CTL_REG  0x08
+#define SUN6I_TFR_CTL_CPHA BIT(0)
+#define SUN6I_TFR_CTL_CPOL BIT(1)
+#define SUN6I_TFR_CTL_SPOL BIT(2)
+#define SUN6I_TFR_CTL_CS_MASK  0x3
+#define SUN6I_TFR_CTL_CS(cs)   (((cs) & SUN6I_TFR_CTL_CS_MASK) 
<< 4)
+#define SUN6I_TFR_CTL_DHB  BIT(8)
+#define SUN6I_TFR_CTL_FBS  BIT(12)
+#define SUN6I_TFR_CTL_XCH  BIT(31)
+
+#define SUN6I_INT_CTL_REG  0x10
+#define SUN6I_INT_CTL_RF_OVF   BIT(8)
+#define SUN6I_INT_CTL_TC   BIT(12)
+
+#define SUN6I_INT_STA_REG  0x14
+
+#define SUN6I_FIFO_CTL_REG 0x18
+#define SUN6I_FIFO_CTL_RF_RST  BIT(15)
+#define SUN6I_FIFO_CTL_TF_RST  BIT(31)
+
+#define SUN6I_FIFO_STA_REG 0x1c
+#define SUN6I_FIFO_STA_RF_CNT_MASK 0x7f
+#define SUN6I_FIFO_STA_RF_CNT_BITS 0
+#define SUN6I_FIFO_STA_TF_CNT_MASK 0x7f
+#define SUN6I_FIFO_STA_TF_CNT_BITS 16
+
+#define SUN6I_C

[PATCH v2 0/5] Add Allwinner A31 SPI controller support

2014-01-29 Thread Maxime Ripard
Hi everyone,

This patchset brings support for the SPI controller found in the
Allwinner A31 SoC.

Even though the controller supports DMA, the driver only supports PIO
mode for now. This driver will be used to bring up and test DMA on the
SoC, so support for the DMA will come eventually.

It doesn't support transfer larger than the FIFO size (128 bytes) for
now, I expect it to be fixed in the future.

Thanks!
Maxime

Changes from v1:
  - Switched to using the transfer_one and set_cs callbacks
  - Switched to using runtime_pm
  - Report an error when we try to do a transfer larger than the FIFO
size, instead of silently timeouting.
  - Added a Kconfig symbol
  - Move the clock ratio change at transfer time
  - Fixed the PLL6 cell size in the DTSI
  - A few fixes here and there: typos, etc.

Maxime Ripard (5):
  clk: sunxi: Add support for PLL6 on the A31
  ARM: sun6i: dt: Add PLL6 and SPI module clocks
  spi: sunxi: Add Allwinner A31 SPI controller driver
  ARM: sun6i: dt: Add SPI controllers to the A31 DTSI
  ARM: sunxi: Enable A31 SPI and SID in the defconfig

 Documentation/devicetree/bindings/clock/sunxi.txt  |   1 +
 .../devicetree/bindings/spi/spi-sun6i.txt  |  24 ++
 arch/arm/boot/dts/sun6i-a31.dtsi   |  86 +++-
 arch/arm/configs/sunxi_defconfig   |   3 +
 drivers/clk/sunxi/clk-sunxi.c  |  45 ++
 drivers/spi/Kconfig|   7 +
 drivers/spi/Makefile   |   1 +
 drivers/spi/spi-sun6i.c| 478 +
 8 files changed, 636 insertions(+), 9 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/spi/spi-sun6i.txt
 create mode 100644 drivers/spi/spi-sun6i.c

-- 
1.8.4.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


  1   2   3   4   5   6   >