Add AXP 15 power module for A10s Chips

HdG: Note as usual with code imported from the sunxi SDK there are severe
style issues :|

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
axp15: Hookup the axp152 code

HdG: Fixed some checkpatch warnings

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
axp15: Adjust code for 3.4 branch

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
mach-sun5i: Remove bogus debug-uart device

I encountered this while testing my A10s TV-stick, which uses uart0 for
its uart test-pads.

Having this device always registered + uart0_used set in the fex file,
caused 2 uart driver to get registered for uart0, both the regular
serial8250 as well as the 8250-sunxi driver, then when the first uart0
interrupt happens things go boom.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Platform code function rename to resolve gpiolib conflict

Signed-off-by: Alexandr V. Shutko <alex@shutko.ru>
Allow pin read in output mode

Signed-off-by: Alexandr V. Shutko <alex@shutko.ru>
sunxi: move clocksource code to plat-sunxi

It is identical for sun4i and sun5i, so no merging was needed.

Note checkpatch very much dislikes the code, but this patch does not change it,
it just moves it around.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sunxi: Merge/move core.c code from mach to plat

Note that:
1) This patch also includes one functionaly change, the clock_event_device
declared in core.c had a rating of 100 in sun4i and of 300 for sun5i. This
patch keeps the sun4i setting, thereby working around the timer0 code being
broken in periodic mode (something to fix another day), as the working
"highres" clock_event_device from clocksrc.c has a rating of 300 and thus
gets used instead *if* CONFIG_HIGH_RES_TIMERS is set!

This subtle change fixes the sun5i_defconfig kernel hanging within 10 - 30
seconds after boot due to the timer stopping.

2) checkpatch dislikes parts of this patch, but this patch is just moving
(ugly) code around not introducing it.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sunxi: Add sunxi_*_mem_reserve kernel cmdline options

This patch adds the following kernel commandline options:
sunxi_g2d_mem_reserve
sunxi_ve_mem_reserve
sunxi_fb_mem_reserve

These can be set to configure the amount of RAM (in MB) to reserve for the
named sunxi drivers. This is useful for kernels for ready-to-use disk images,
so that an user can choose to use various binary only drivers to use the
hardware blocks in question, while not making the memory unavailable for
general use for users who choose not to use these drivers, without requiring
a kernel recompile.

IE I'm currently using the following since I don't use any binary drivers:
sunxi_g2d_mem_reserve=0 sunxi_ve_mem_reserve=0 sunxi_fb_mem_reserve=16

Giving me an additional 112 MB of extra memory.

Note that:
1) This patch also allows making the reservations larger in an easy way :)
2) This patch removes the comments stating that memory won't be reserved if
the block in question is disabled in the fex file, since this was not true
before this patch, and still is not true after this patch.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sunxi: Also allow disabling MALI mem reservation from the cmdline

This patch adds a new "sunxi_no_mali_mem_reserve" kernel commandline options
to disable the memory reservation for the mali driver, makign the 64MB of
RAM in question usable for other purposes.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sunxi-disp: Fall back to kmalloc-ed mem when no fb mem is reserved

Since it is now possible to disable fb-mem reservation from the cmdline,
enable the kmalloc fallback path even if CONFIG_FB_SUNXI_RESERVED_MEM is set.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
axp20: Don't create the virtual axp devs if pmu_used is not set

This stops dmesg showing these:
[   86.720000] platform reg-20-cs-buck3: Driver reg-20-cs-buck3 requests probe deferral
[   86.720000] platform reg-20-cs-buck2: Driver reg-20-cs-buck2 requests probe deferral
[   86.740000] platform reg-20-cs-ldo4: Driver reg-20-cs-ldo4 requests probe def
<snip more of the same>

Each time a usb device gets (un)plugged when using a generic kernel build
(so with axp20 enabled) on a board without a pmu, such as the mk802, or
the a13_olinuxino_micro.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sunxi-cpu-freq: Unify sun4i and sun5i code

Note if you do a diff between the 2, there are some differences, where as
this patch just moves the mach-sun4i code to plat-sunxi. The reason for this
is that the sun5i code does the same as the sun4i code just in a more
complicated manner.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sunxi-cpu-freq: Tweak cpufreq limits

cpu-freq has 2 sets of limits, 1 called cpuinfo which indicates what the
minimum / maximum freq of the cpu is, and the 2nd set indicates between
which limits the governor should automatically scale.

This patch splits the setting of the 2 sets of limits, and adds a
SUNXI_SCALING_MIN Kconfig option to allow raising the minimum speed
the (ondemand) governor will use from the current 60 MHz, which is
unworkably slow IMHO, to something better, ie 408 MHz, which is the last
speed at which the cpu runs at its lowest voltage of 1.0 volt.

This patch keeps the default at 60 MHz, to avoid regressions in battery
use, but I would like to advocate people to try out 408 Mhz instead,
which not only makes the interactive feel of the device a lot better, it
likely also *saves* power since it will cause the cpu to reach an idle
state quicker, which will allow it to power down entire blocks, thus stopping
the constant (non speed dependent) leakage current of those blocks sooner,
while using aprox. the same amount of power to do the work (it uses more
power due to the higher clock, but does the work proportionally faster,
resulting in aprox. the same power use). This is the so called race to idle
trick.

While at it also fix the formatting of sun4i_cpufreq_init().

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sunxi: Enabled gpiolib

Added missing header files and config options to enable
gpiolib support with sysfs

Signed-off-by: Alexandr V. Shutko <alex@shutko.ru>
Added gpio driver for sunxi platform

This is gpio driver for sunxi platform. It based on gpiolib
framework and supports get/set value, change direction, poll(2)
on value (gpio irq).

Signed-off-by: Alexandr V. Shutko <alex@shutko.ru>
modedb: fb_find_nearest_mode compare interlaced versus progressive

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sunxi-disp: ParseEDID: make BlockCount reflect number of blocks

Signed-off-by: Michal Suchanek <hramrach@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sunxi-disp: Pass all edid blocks in one go to disp

Signed-off-by: Michal Suchanek <hramrach@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sunxi-disp: Split out the cycle of ParseEDID into ParseEDID_CEA861_extension_block

Changes by HdG:
1) Renamed function from ParseEDID_DataBlock to
   ParseEDID_CEA861_extension_block
2) Removed the "if (BlockCount > 1)" checks since the
   "for (i = 1; i < BlockCount; i++) {" ... "}" is a nop then anyways

Signed-off-by: Michal Suchanek <hramrach@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>