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

Commit c404b25e authored by Yeleswarapu Nagaradhesh's avatar Yeleswarapu Nagaradhesh Committed by Gerrit - the friendly Code Review server
Browse files

ASoC: wcd9xxx: add support for wcd934x codec



Add wcd934x as a mfd child and configure regmap.
Configure MCLK as per the HW sequence.

CRs-Fixed: 1041199
Change-Id: I9e2dbb0f0acaa1442c1624556bc52abf98158c92
Signed-off-by: default avatarYeleswarapu Nagaradhesh <nagaradh@codeaurora.org>
parent 5be00f77
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -87,6 +87,7 @@ static const int wcd9xxx_cdc_types[] = {
	[WCD9XXX] = WCD9XXX,
	[WCD9330] = WCD9330,
	[WCD9335] = WCD9335,
	[WCD934X] = WCD934X,
};

static const struct of_device_id wcd9xxx_of_match[] = {
@@ -326,7 +327,7 @@ int wcd9xxx_slim_write_repeat(struct wcd9xxx *wcd9xxx, unsigned short reg,
	struct slim_ele_access slim_msg;

	mutex_lock(&wcd9xxx->io_lock);
	if (wcd9xxx->type == WCD9335) {
	if (wcd9xxx->type == WCD9335 || wcd9xxx->type == WCD934X) {
		ret = wcd9xxx_page_write(wcd9xxx, &reg);
		if (ret)
			goto done;
@@ -1321,7 +1322,7 @@ static int wcd9xxx_slim_probe(struct slim_device *slim)
	 * Vout_D to be ready after BUCK_SIDO is powered up.
	 * SYS_RST_N shouldn't be pulled high during this time
	 */
	if (wcd9xxx->type == WCD9335)
	if (wcd9xxx->type == WCD9335 || wcd9xxx->type == WCD934X)
		usleep_range(600, 650);
	else
		usleep_range(5, 10);
@@ -1555,6 +1556,7 @@ static const struct slim_device_id wcd_slim_device_id[] = {
	{"tapan-slim-pgd", 0},
	{"tomtom-slim-pgd", WCD9330},
	{"tasha-slim-pgd", WCD9335},
	{"tavil-slim-pgd", WCD934X},
	{}
};

+10 −1
Original line number Diff line number Diff line
/*
 * Copyright (c) 2015, The Linux Foundation. All rights reserved.
 * Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -19,6 +19,10 @@

typedef int (*regmap_patch_fptr)(struct regmap *, int);

#ifdef CONFIG_WCD934X_CODEC
extern struct regmap_config wcd934x_regmap_config;
#endif

#ifdef CONFIG_WCD9335_CODEC
extern struct regmap_config wcd9335_regmap_config;
extern int wcd9335_regmap_register_patch(struct regmap *regmap,
@@ -34,6 +38,11 @@ static inline struct regmap_config *wcd9xxx_get_regmap_config(int type)
	struct regmap_config *regmap_config;

	switch (type) {
#ifdef CONFIG_WCD934X_CODEC
	case WCD934X:
		regmap_config = &wcd934x_regmap_config;
		break;
#endif
#ifdef CONFIG_WCD9335_CODEC
	case WCD9335:
		regmap_config = &wcd9335_regmap_config;
+11 −1
Original line number Diff line number Diff line
@@ -37,6 +37,12 @@

static enum wcd9xxx_intf_status wcd9xxx_intf = -1;

static struct mfd_cell tavil_devs[] = {
	{
		.name = "tavil_codec",
	},
};

static struct mfd_cell tasha_devs[] = {
	{
		.name = "tasha_codec",
@@ -418,7 +424,7 @@ int wcd9xxx_page_write(struct wcd9xxx *wcd9xxx, unsigned short *reg)
	unsigned short c_reg, reg_addr;
	u8 pg_num, prev_pg_num;

	if (wcd9xxx->type != WCD9335)
	if (wcd9xxx->type != WCD9335 && wcd9xxx->type != WCD934X)
		return ret;

	c_reg = *reg;
@@ -815,6 +821,10 @@ int wcd9xxx_get_codec_info(struct device *dev)
	}

	switch (wcd9xxx->type) {
	case WCD934X:
		cinfo->dev = tavil_devs;
		cinfo->size = ARRAY_SIZE(tavil_devs);
		break;
	case WCD9335:
		cinfo->dev = tasha_devs;
		cinfo->size = ARRAY_SIZE(tasha_devs);
+2 −0
Original line number Diff line number Diff line
@@ -76,6 +76,7 @@ enum codec_variant {
	WCD9330,
	WCD9335,
	WCD9326,
	WCD934X,
};

enum wcd9xxx_slim_slave_addr_type {
@@ -252,6 +253,7 @@ enum wcd9xxx_chipid_major {
	TOMTOM_MAJOR = cpu_to_le16(0x105),
	TASHA_MAJOR = cpu_to_le16(0x0),
	TASHA2P0_MAJOR = cpu_to_le16(0x107),
	TAVIL_MAJOR = cpu_to_le16(0x108),
};

enum codec_power_states {
+22 −0
Original line number Diff line number Diff line
@@ -33,6 +33,13 @@ typedef int (*codec_bringdown_fn)(struct wcd9xxx *);
typedef int (*codec_type_fn)(struct wcd9xxx *,
			     struct wcd9xxx_codec_type *);

#ifdef CONFIG_WCD934X_CODEC
extern int wcd934x_bringup(struct wcd9xxx *wcd9xxx);
extern int wcd934x_bringdown(struct wcd9xxx *wcd9xxx);
extern int wcd934x_get_codec_info(struct wcd9xxx *,
				  struct wcd9xxx_codec_type *);
#endif

#ifdef CONFIG_WCD9335_CODEC
extern int wcd9335_bringup(struct wcd9xxx *wcd9xxx);
extern int wcd9335_bringdown(struct wcd9xxx *wcd9xxx);
@@ -52,6 +59,11 @@ static inline codec_bringdown_fn wcd9xxx_bringdown_fn(int type)
	codec_bringdown_fn cdc_bdown_fn;

	switch (type) {
#ifdef CONFIG_WCD934X_CODEC
	case WCD934X:
		cdc_bdown_fn = wcd934x_bringdown;
		break;
#endif
#ifdef CONFIG_WCD9335_CODEC
	case WCD9335:
		cdc_bdown_fn = wcd9335_bringdown;
@@ -75,6 +87,11 @@ static inline codec_bringup_fn wcd9xxx_bringup_fn(int type)
	codec_bringup_fn cdc_bup_fn;

	switch (type) {
#ifdef CONFIG_WCD934X_CODEC
	case WCD934X:
		cdc_bup_fn = wcd934x_bringup;
		break;
#endif
#ifdef CONFIG_WCD9335_CODEC
	case WCD9335:
		cdc_bup_fn = wcd9335_bringup;
@@ -98,6 +115,11 @@ static inline codec_type_fn wcd9xxx_get_codec_info_fn(int type)
	codec_type_fn cdc_type_fn;

	switch (type) {
#ifdef CONFIG_WCD934X_CODEC
	case WCD934X:
		cdc_type_fn = wcd934x_get_codec_info;
		break;
#endif
#ifdef CONFIG_WCD9335_CODEC
	case WCD9335:
		cdc_type_fn = wcd9335_get_codec_info;
Loading