[Atrix 4G General] krystianp:
To give you idea with what we have to deal trying to get something out of reversed code, here's something i'm working on currently...

c03e040c:	e92d41f0	push	{r4, r5, r6, r7, r8, lr}
c03e0410:	e5903008	ldr	r3, [r0, #8]	;r3 = rtf = substream->private_data;
c03e0414:	e1a07001	mov	r7, r1	;r7 = *params = struct snd_pcm_hw_params
c03e0418:	e59f0110	ldr	r0, [pc, #272]	; c03e0530: (c06c00b0) **"<6>ALSA MOTSND:%s: entered"-><6>ALSA
c03e041c:	e59f1110	ldr	r1, [pc, #272]	; c03e0534: (c05781e8) **"motsnd_hw_params"->__func__.28516
c03e0420:	e5932188	ldr	r2, [r3, #392] ;
c03e0424:	e5934190	ldr	r4, [r3, #400] ;
c03e0428:	e5935194	ldr	r5, [r3, #404] ;
c03e042c:	e5923034	ldr	r3, [r2, #52] ;
c03e0430:	e5936160	ldr	r6, [r3, #352] ;
c03e0434:	eb04e3a9	bl	<printk>
c03e0438:	e5971128	ldr	r1, [r7, #296] ;
c03e043c:	e59f30f4	ldr	r3, [pc, #244]	; c03e0538: (00015888) r3 = 88200
c03e0440:	e1510003	cmp	r1, r3	; if (r1==88200)
c03e0444:	0a000005	beq	loc_c03e0460	; jump label2
loc_c03e0448 (label1):
c03e0448:	e59f30ec	ldr	r3, [pc, #236]	; c03e053c: (00017700) r3 = 96000
c03e044c:	e1510003	cmp	r1, r3	; if (r1==96000)
c03e0450:	0a000002	beq	loc_c03e0460	; jump label2
c03e0454:	e3510cfa	cmp	r1, #64000	; if (r1!=64000) {
c03e0458:	11a02401	lslne	r2, r1, #8	; r2 = r1 << 8 =
c03e045c:	1a000003	bne	loc_c03e0470	; jump label4}
loc_c03e0460 (label2): ; 2 refs
c03e0460:	e1a02381	lsl	r2, r1, #7	; r2 = r1 << 7 =
c03e0464:	ea000001	b	loc_c03e0470	;
loc_c03e0468 (label3):
c03e0468:	e1a02082	lsl	r2, r2, #1
c03e046c:	ea000000	b	loc_c03e0474
loc_c03e0470 (label4): ; 2 refs
c03e0470:	e59f30c8	ldr	r3, [pc, #200]	; c03e0540: (005b8d7f) r3 = 5999999
loc_c03e0474 (label5):
c03e0474:	e1520003	cmp	r2, r3	;
c03e0478:	dafffffa	ble	loc_c03e0468	;
c03e047c:	e3560000	cmp	r6, #0	; 0x0
c03e0480:	0a000005	beq	loc_c03e049c
c03e0484:	e1a00006	mov	r0, r6
c03e0488:	ebfffb35	bl	<tegra_asoc_utils_set_rate>

This equals more or less to:

static int motsnd_hw_params(struct snd_pcm_substream *substream,	//verified??
struct snd_pcm_hw_params *params)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *codec_dai = rtd->codec_dai;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
struct snd_soc_codec *codec = rtd->codec;
struct snd_soc_card *card = codec->card;
struct tegra_olympus *card_data = snd_soc_card_get_drvdata(card);
int srate, mclk;
int err, ret;

MOTSND_DEBUG_LOG("%s: entered\n", __func__);

if (card_data==NULL) {
dev_err(card->dev, "card_data is NULL\n");
return -1;
}

/* Set codec clock configuration */
//srate = params_rate(params);
//mclk = 128 * srate;

printk("%s: mclk (%d) = 128 * srate (%d);\n", __func__, mclk, srate);

err = tegra_asoc_utils_set_rate(&card_data->util_data, srate, mclk);

c03e0420:	e5932188	ldr	r2, [r3, #392] ; <-- here we have some field of struct snd_soc_pcm_runtime at offset 392

This struct has

struct device *	dev
struct snd_soc_card *	card
struct snd_soc_dai_link *	dai_link
struct mutex	pcm_mutex
enum snd_soc_pcm_subclass	pcm_subclass
struct snd_pcm_ops	ops
unsigned int	complete:1
unsigned int	dev_registered:1
long	pmdown_time
struct snd_pcm *	pcm
struct snd_soc_codec *	codec
struct snd_soc_platform *	platform
struct snd_soc_dai *	codec_dai
struct snd_soc_dai *	cpu_dai
struct delayed_work	delayed_work

fields. To get this particular piece of data (at that offset) we would have to get all stucts (not pointers) which are used in snd_soc_pcm_runtime until we reach the deepest level and then count each field size, then if we didn't make any mistake we would get the field we need. So as you can see it's not that quick to get anything out of it. But following my intuition i assumed some things:

1. Last fields of this struct are:

struct snd_soc_codec *	codec <----- 4bytes
struct snd_soc_platform *	platform <----- 4bytes
struct snd_soc_dai *	codec_dai <----- 4bytes
struct snd_soc_dai *	cpu_dai <----- 4bytes
struct delayed_work	delayed_work <----- maybe some more bytes

Looking at omap code we have:

struct snd_soc_dai *codec_dai = rtd->codec_dai;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
struct snd_soc_codec *codec = rtd->codec;

And on disassembled file:

c03e0420:	e5932188	ldr	r2, [r3, #392] ;
c03e0424:	e5934190	ldr	r4, [r3, #400] ;
c03e0428:	e5935194	ldr	r5, [r3, #404] ;

As you can see we have here offsets: x (#392), x+8 (#400), x+12(#404), which resembles fields: codec (x), codec_dai (x+8), cpu_dai(x+12). So assuming that my assumption was correct we can assume that we know now what is loaded to r2, r4 and r5. And another 3 lines of dissassembled file are reversed. The end ;)