Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1bcc1c82 authored by tracychui's avatar tracychui Committed by Rohit Sekhar
Browse files

mmc: Add memory detect node for service menu

Issue: FP3-A11#230
Change-Id: I0e3aa68cdeca14fe304fcdeef216c6349953a5dc
parent efda3d36
Loading
Loading
Loading
Loading
+32 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
#include <linux/slab.h>
#include <linux/stat.h>
#include <linux/pm_runtime.h>
#include <linux/seq_file.h>

#include <linux/mmc/host.h>
#include <linux/mmc/card.h>
@@ -27,10 +28,13 @@
#include "bus.h"
#include "mmc_ops.h"
#include "sd_ops.h"
#include <linux/proc_fs.h>

#define DEFAULT_CMD6_TIMEOUT_MS	500
#define MIN_CACHE_EN_TIMEOUT_MS 1600

static u32 memory_cid = 0x0;

static const unsigned int tran_exp[] = {
	10000,		100000,		1000000,	10000000,
	0,		0,		0,		0
@@ -3156,6 +3160,29 @@ static const struct mmc_bus_ops mmc_ops = {
	.post_hibernate = mmc_post_hibernate
};

static int proc_memory_vendor_show(struct seq_file *m, void *v)
{
	if (memory_cid==0x15010052) {
		seq_printf(m, "Samsung_2nd\n");
	}
	else {
		seq_printf(m, "Samsung_Main\n");
	}
	return 0;
}

static int proc_memory_vendor_open(struct inode *inode, struct file *file)
{
	return single_open(file, proc_memory_vendor_show, NULL);
}

static const struct file_operations proc_memory_vendor_fops = {
	.open  = proc_memory_vendor_open,
	.read = seq_read,
	.llseek = seq_lseek,
	.release = single_release,
};

/*
 * Starting point for MMC card init.
 */
@@ -3219,6 +3246,11 @@ int mmc_attach_mmc(struct mmc_host *host)

	register_reboot_notifier(&host->card->reboot_notify);

	proc_create("memory_vendor", 0, NULL, &proc_memory_vendor_fops);
	if (host->card->type == MMC_TYPE_MMC) {
		memory_cid=host->card->raw_cid[0];
	}

	return 0;

remove_card: