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

Commit 3513a01c authored by Tatenda Chipeperekwa's avatar Tatenda Chipeperekwa
Browse files

drivers: soc: qcom: fix FSA4480 settings for DisplayPort orientation



Fix the programming of the FSA4480 switch to enable DisplayPort
functionality based on orientation changes on the USB-C plug.

Change-Id: Id065b8ad4bc96d011549ff44a40b514671f5c4c0
Signed-off-by: default avatarTatenda Chipeperekwa <tatendac@codeaurora.org>
parent cb4febf1
Loading
Loading
Loading
Loading
+19 −4
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@

#define FSA4480_SWITCH_SETTINGS 0x04
#define FSA4480_SWITCH_CONTROL  0x05
#define FSA4480_SWITCH_STATUS1  0x07
#define FSA4480_SLOW_L          0x08
#define FSA4480_SLOW_R          0x09
#define FSA4480_SLOW_MIC        0x0A
@@ -198,6 +199,20 @@ int fsa4480_unreg_notifier(struct notifier_block *nb,
}
EXPORT_SYMBOL(fsa4480_unreg_notifier);

static int fsa4480_validate_display_port_settings(struct fsa4480_priv *fsa_priv)
{
	u32 switch_status = 0;

	regmap_read(fsa_priv->regmap, FSA4480_SWITCH_STATUS1, &switch_status);

	if ((switch_status != 0x23) && (switch_status != 0x1C)) {
		pr_err("AUX SBU1/2 switch status is invalid = %u\n",
				switch_status);
		return -EIO;
	}

	return 0;
}
/*
 * fsa4480_switch_event - configure FSA switch position based on event
 *
@@ -233,11 +248,11 @@ int fsa4480_switch_event(struct device_node *node,
		fsa4480_usbc_update_settings(fsa_priv, switch_control, 0x9F);
		break;
	case FSA_USBC_ORIENTATION_CC1:
		fsa4480_usbc_update_settings(fsa_priv, 0x78, 0xF8);
		break;
		fsa4480_usbc_update_settings(fsa_priv, 0x00, 0xE0);
		return fsa4480_validate_display_port_settings(fsa_priv);
	case FSA_USBC_ORIENTATION_CC2:
		fsa4480_usbc_update_settings(fsa_priv, 0x18, 0xF8);
		break;
		fsa4480_usbc_update_settings(fsa_priv, 0x60, 0xE0);
		return fsa4480_validate_display_port_settings(fsa_priv);
	default:
		break;
	}