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

Commit 9fcf9a12 authored by edwardkao(153792)'s avatar edwardkao(153792) Committed by Gerrit Code Review
Browse files

Merge "Add memory detect node for service menu" into 8901-fairphone-p-mp-release

parents 81822fb1 7db09210
Loading
Loading
Loading
Loading
+21 −28
Original line number Diff line number Diff line
@@ -1018,7 +1018,6 @@ void himax_read_file_func(char *pFilePath, u8 *pBuf, u16 nLength)

    pFile->f_op->llseek(pFile, 0, SEEK_SET);
    nReadBytes = pFile->f_op->read(pFile, pBuf, nLength, &pFile->f_pos);
    printk ( "[Tracy]Read %d bytes!\n", (int)nReadBytes);

    set_fs(old_fs);

@@ -1037,7 +1036,6 @@ u8 szChargerStatus[20] = {0};
	if (ts->suspended==false)
	{
		himax_read_file_func(POWER_SUPPLY_BATTERY_STATUS_PATCH, szChargerStatus, 20);
	    printk("[Tracy]Battery Status : %s \n", szChargerStatus);
			if (strstr(szChargerStatus, "Charging") != NULL || strstr(szChargerStatus, "Full") != NULL || strstr(szChargerStatus, "Fully charged") != NULL) // Charging
				{
					connect_status=1;
@@ -1052,7 +1050,6 @@ u8 szChargerStatus[20] = {0};
	{
		if (((!!connect_status) != ts->usb_connected) || force_renew)
		{

			if (!!connect_status)
			{
			ts->cable_config[1] = 0x01;
@@ -1063,13 +1060,9 @@ u8 szChargerStatus[20] = {0};
			ts->cable_config[1] = 0x00;
			ts->usb_connected = 0x00;
			}

		himax_usb_detect_set(ts->client,ts->cable_config);

            I("%s: Cable status change: 0x%2.2X\n", __func__, ts->usb_connected);
		printk("%s: Cable status change: 0x%2.2X\n", __func__, ts->usb_connected);
		}
        //else
        //	I("%s: Cable status is the same as previous one, ignore.\n", __func__);
	}
}
/*[Arima_8901][TracyChui] 20190816 end */

drivers/mmc/core/mmc.c

100644 → 100755
+48 −0
Original line number Diff line number Diff line
@@ -21,6 +21,9 @@
#include <linux/mmc/mmc.h>
#include <linux/reboot.h>
#include <trace/events/mmc.h>
/* [20191101][TracyChui]Add memory detect node for service menu start */
#include <linux/proc_fs.h>
/* [20191101][TracyChui]Add memory detect node for service menu end */

#include "core.h"
#include "host.h"
@@ -30,6 +33,15 @@

#define DEFAULT_CMD6_TIMEOUT_MS	500

/* [20191101][TracyChui]Add memory detect node for service menu start */
extern void seq_printf(struct seq_file *m, const char *f, ...);
extern int single_open(struct file *, int (*)(struct seq_file *, void *), void *);
extern ssize_t seq_read(struct file *, char __user *, size_t, loff_t *);
extern loff_t seq_lseek(struct file *, loff_t, int);
extern int single_release(struct inode *, struct file *);
static u32 memory_cid;
/* [20191101][TracyChui]Add memory detect node for service menu end */

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

/* [20191101][TracyChui]Add memory detect node for service menu start */
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,
};
/* [20191101][TracyChui]Add memory detect node for service menu end */

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

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

	/* [20191101][TracyChui]Add memory detect node for service menu start */
	proc_create("memory_vendor", 0, NULL, &proc_memory_vendor_fops);

	if(host->card->type == MMC_TYPE_MMC)
		{
			memory_cid=host->card->raw_cid[0];
		}
	/* [20191101][TracyChui]Add memory detect node for service menu end */

	return 0;

remove_card: