This post is basically works for stock andriod and probably on most of the andriod phones.
When i faced a issue of my phone ear speaker and mic not working
only during cellular call, then i found some post how to resolve it and it works for me so I though to share it to every one.
This not only solves my problems, but I hope it helps lot of issues so I am trying to share it so that it may help to some one.
How do I clear Cache Partition on my device?
This will remove any temporary files that may be causing the
problem, but will not delete your files or
settings.
Lollipop
Steps
1. Ensure the device is powered off, and unplugged
2. Press and hold the Volume Down button
and Power button (located on the right edge of the
device) for approximately 3 seconds then release.
3. From the "Boot Mode Selection Menu" screen, select Recovery.
Note: Use the Volume Down button to scroll through the menu
options and the Volume Up button to select.
4. From the "No Command" screen (Android figure lying
on his back), press and hold the Power button
then press and release theVolume Up button
to display the menu options.
5. Select "wipe cache partition".
Note: Use the Volume buttons to highlight and the Power button to select.
Note: Allow many minutes (10-20mns) for the "wipe cache partition" process to complete.
6. "Reboot system now"
will be highlighted, press the Power button to
select it.
Note: Allow several
minutes for the reboot process to complete.
KitKat
Steps
1.
With the phone powered
off, press the VOL DOWN KEY for 2-3 seconds then POWER key then release.
2. The device will display different BOOT OPTIONS
3. Use the VOL DOWN Key to
SCROLL to Recovery and VOL UP Key to select
Tip: If the device reboots, you may have waited to long
to make a selection, you will need to begin the process again.
4. The device will display the Motorola logo and
then the Android in distress ( logo with Exclamation mark)
5. Press and hold the VOL UP key for 10-15 seconds. While still holding
the VOL UP key tap and release the POWER key
Tip: You can try this step, holding the phone in
landscape. If you are stuck on step 6, try a force reboot by pressing the Power
key and Vol Down key, and start the process again.
6. The device will display additional menu
options (Text will appear in BLUE)
7. Use the VOL DOWN Key to
scroll to wipe cache partition and the POWER Key to select this option
8. The device will then perform the partition
wipe
9. The device will reboot and start the normal
power up sequence
Source from Motorola portal customer care.