Loading arch/arm/boot/dts/qcom/msmcobalt-audio.dtsi +5 −1 Original line number Diff line number Diff line Loading @@ -174,7 +174,11 @@ "msm-dai-q6-dev.28672", "msm-dai-q6-dev.28673"; asoc-codec = <&stub_codec>; asoc-codec-names = "msm-stub-codec.1"; qcom,wsa-max-devs = <0>; qcom,wsa-max-devs = <2>; qcom,wsa-devs = <&wsa881x_0211>, <&wsa881x_0212>, <&wsa881x_0213>, <&wsa881x_0214>; qcom,wsa-aux-dev-prefix = "SpkrLeft", "SpkrRight", "SpkrLeft", "SpkrRight"; }; cpe: qcom,msm-cpe-lsm { Loading arch/arm/boot/dts/qcom/msmcobalt-wcd.dtsi 0 → 100644 +96 −0 Original line number Diff line number Diff line /* Copyright (c) 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 * only version 2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ &slim_aud { tasha_codec { wsa_spkr_sd1: msm_cdc_pinctrll { compatible = "qcom,msm-cdc-pinctrl"; pinctrl-names = "aud_active", "aud_sleep"; pinctrl-0 = <&spkr_1_sd_n_active>; pinctrl-1 = <&spkr_1_sd_n_sleep>; }; wsa_spkr_sd2: msm_cdc_pinctrlr { compatible = "qcom,msm-cdc-pinctrl"; pinctrl-names = "aud_active", "aud_sleep"; pinctrl-0 = <&spkr_2_sd_n_active>; pinctrl-1 = <&spkr_2_sd_n_sleep>; }; }; tavil_codec { wcd: wcd_pinctrl@5 { compatible = "qcom,wcd-pinctrl"; qcom,num-gpios = <5>; gpio-controller; #gpio-cells = <2>; spkr_1_wcd_en_active: spkr_1_wcd_en_active { mux { pins = "gpio2"; }; config { pins = "gpio2"; output-high; }; }; spkr_1_wcd_en_sleep: spkr_1_wcd_en_sleep { mux { pins = "gpio2"; }; config { pins = "gpio2"; input-enable; }; }; spkr_2_wcd_en_active: spkr_2_sd_n_active { mux { pins = "gpio3"; }; config { pins = "gpio3"; output-high; }; }; spkr_2_wcd_en_sleep: spkr_2_sd_n_sleep { mux { pins = "gpio3"; }; config { pins = "gpio3"; input-enable; }; }; }; wsa_spkr_wcd_sd1: msm_cdc_pinctrll { compatible = "qcom,msm-cdc-pinctrl"; pinctrl-names = "aud_active", "aud_sleep"; pinctrl-0 = <&spkr_1_wcd_en_active>; pinctrl-1 = <&spkr_1_wcd_en_sleep>; }; wsa_spkr_wcd_sd2: msm_cdc_pinctrlr { compatible = "qcom,msm-cdc-pinctrl"; pinctrl-names = "aud_active", "aud_sleep"; pinctrl-0 = <&spkr_2_wcd_en_active>; pinctrl-1 = <&spkr_2_wcd_en_sleep>; }; }; }; arch/arm/boot/dts/qcom/msmcobalt-wsa881x.dtsi +5 −22 Original line number Diff line number Diff line Loading @@ -9,24 +9,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ &soc { wsa_spkr_sd1: msm_cdc_pinctrl@65 { compatible = "qcom,msm-cdc-pinctrl"; qcom,cdc-rst-n-gpio = <&tlmm 65 0>; pinctrl-names = "aud_active", "aud_sleep"; pinctrl-0 = <&spkr_1_sd_n_active>; pinctrl-1 = <&spkr_1_sd_n_sleep>; }; wsa_spkr_sd2: msm_cdc_pinctrl@66 { compatible = "qcom,msm-cdc-pinctrl"; qcom,cdc-rst-n-gpio = <&tlmm 66 0>; pinctrl-names = "aud_active", "aud_sleep"; pinctrl-0 = <&spkr_2_sd_n_active>; pinctrl-1 = <&spkr_2_sd_n_sleep>; }; }; #include "msmcobalt-wcd.dtsi" &slim_aud { tasha_codec { Loading Loading @@ -70,25 +53,25 @@ wsa881x_0211: wsa881x@20170211 { compatible = "qcom,wsa881x"; reg = <0x00 0x20170211>; qcom,spkr-sd-n-node = <&wsa_spkr_sd1>; qcom,spkr-sd-n-node = <&wsa_spkr_wcd_sd1>; }; wsa881x_0212: wsa881x@20170212 { compatible = "qcom,wsa881x"; reg = <0x00 0x20170212>; qcom,spkr-sd-n-node = <&wsa_spkr_sd2>; qcom,spkr-sd-n-node = <&wsa_spkr_wcd_sd2>; }; wsa881x_0213: wsa881x@21170213 { compatible = "qcom,wsa881x"; reg = <0x00 0x21170213>; qcom,spkr-sd-n-node = <&wsa_spkr_sd1>; qcom,spkr-sd-n-node = <&wsa_spkr_wcd_sd1>; }; wsa881x_0214: wsa881x@21170214 { compatible = "qcom,wsa881x"; reg = <0x00 0x21170214>; qcom,spkr-sd-n-node = <&wsa_spkr_sd2>; qcom,spkr-sd-n-node = <&wsa_spkr_wcd_sd2>; }; }; }; Loading sound/soc/codecs/wcd9335.c +49 −29 Original line number Diff line number Diff line Loading @@ -129,6 +129,7 @@ #define WCD9335_DEC_PWR_LVL_LP 0x02 #define WCD9335_DEC_PWR_LVL_HP 0x04 #define WCD9335_DEC_PWR_LVL_DF 0x00 #define WCD9335_STRING_LEN 100 #define CALCULATE_VOUT_D(req_mv) (((req_mv - 650) * 10) / 25) Loading Loading @@ -786,7 +787,7 @@ struct tasha_priv { /* to track the status */ unsigned long status_mask; struct work_struct swr_add_devices_work; struct work_struct tasha_add_child_devices_work; struct wcd_swr_ctrl_platform_data swr_plat_data; /* Port values for Rx and Tx codec_dai */ Loading Loading @@ -13464,7 +13465,7 @@ static int tasha_swrm_handle_irq(void *handle, return ret; } static void wcd_swr_ctrl_add_devices(struct work_struct *work) static void tasha_add_child_devices(struct work_struct *work) { struct tasha_priv *tasha; struct platform_device *pdev; Loading @@ -13473,9 +13474,10 @@ static void wcd_swr_ctrl_add_devices(struct work_struct *work) struct tasha_swr_ctrl_data *swr_ctrl_data = NULL, *temp; int ret, ctrl_num = 0; struct wcd_swr_ctrl_platform_data *platdata; char plat_dev_name[WCD9335_STRING_LEN]; tasha = container_of(work, struct tasha_priv, swr_add_devices_work); tasha_add_child_devices_work); if (!tasha) { pr_err("%s: Memory for WCD9335 does not exist\n", __func__); Loading @@ -13496,17 +13498,17 @@ static void wcd_swr_ctrl_add_devices(struct work_struct *work) platdata = &tasha->swr_plat_data; for_each_child_of_node(wcd9xxx->dev->of_node, node) { temp = krealloc(swr_ctrl_data, (ctrl_num + 1) * sizeof(struct tasha_swr_ctrl_data), GFP_KERNEL); if (!temp) { dev_err(wcd9xxx->dev, "out of memory\n"); ret = -ENOMEM; goto err; } swr_ctrl_data = temp; swr_ctrl_data[ctrl_num].swr_pdev = NULL; pdev = platform_device_alloc("tasha_swr_ctrl", -1); if (!strcmp(node->name, "swr_master")) strlcpy(plat_dev_name, "tasha_swr_ctrl", (WCD9335_STRING_LEN - 1)); else if (strnstr(node->name, "msm_cdc_pinctrl", strlen("msm_cdc_pinctrl")) != NULL) strlcpy(plat_dev_name, node->name, (WCD9335_STRING_LEN - 1)); else continue; pdev = platform_device_alloc(plat_dev_name, -1); if (!pdev) { dev_err(wcd9xxx->dev, "%s: pdev memory alloc failed\n", __func__); Loading @@ -13516,28 +13518,45 @@ static void wcd_swr_ctrl_add_devices(struct work_struct *work) pdev->dev.parent = tasha->dev; pdev->dev.of_node = node; if (!strcmp(node->name, "swr_master")) { ret = platform_device_add_data(pdev, platdata, sizeof(*platdata)); if (ret) { dev_err(&pdev->dev, "%s: cannot add plat data for ctrl:%d\n", dev_err(&pdev->dev, "%s: cannot add plat data ctrl:%d\n", __func__, ctrl_num); goto fail_pdev_add; } } ret = platform_device_add(pdev); if (ret) { dev_err(&pdev->dev, "%s: Cannot add swr platform device\n", dev_err(&pdev->dev, "%s: Cannot add platform device\n", __func__); goto fail_pdev_add; } if (!strcmp(node->name, "swr_master")) { temp = krealloc(swr_ctrl_data, (ctrl_num + 1) * sizeof( struct tasha_swr_ctrl_data), GFP_KERNEL); if (!temp) { dev_err(wcd9xxx->dev, "out of memory\n"); ret = -ENOMEM; goto err; } swr_ctrl_data = temp; swr_ctrl_data[ctrl_num].swr_pdev = pdev; ctrl_num++; dev_dbg(&pdev->dev, "%s: Added soundwire ctrl device(s)\n", dev_dbg(&pdev->dev, "%s: Added soundwire ctrl device(s)\n", __func__); } tasha->nr = ctrl_num; tasha->swr_ctrl_data = swr_ctrl_data; } } return; fail_pdev_add: Loading Loading @@ -13637,7 +13656,8 @@ static int tasha_probe(struct platform_device *pdev) INIT_DELAYED_WORK(&tasha->power_gate_work, tasha_codec_power_gate_work); mutex_init(&tasha->power_lock); mutex_init(&tasha->sido_lock); INIT_WORK(&tasha->swr_add_devices_work, wcd_swr_ctrl_add_devices); INIT_WORK(&tasha->tasha_add_child_devices_work, tasha_add_child_devices); BLOCKING_INIT_NOTIFIER_HEAD(&tasha->notifier); mutex_init(&tasha->micb_lock); mutex_init(&tasha->swr_read_lock); Loading Loading @@ -13713,7 +13733,7 @@ static int tasha_probe(struct platform_device *pdev) } /* Update codec register default values */ tasha_update_reg_defaults(tasha); schedule_work(&tasha->swr_add_devices_work); schedule_work(&tasha->tasha_add_child_devices_work); tasha_get_codec_ver(tasha); dev_info(&pdev->dev, "%s: Tasha driver probe done\n", __func__); Loading Loading
arch/arm/boot/dts/qcom/msmcobalt-audio.dtsi +5 −1 Original line number Diff line number Diff line Loading @@ -174,7 +174,11 @@ "msm-dai-q6-dev.28672", "msm-dai-q6-dev.28673"; asoc-codec = <&stub_codec>; asoc-codec-names = "msm-stub-codec.1"; qcom,wsa-max-devs = <0>; qcom,wsa-max-devs = <2>; qcom,wsa-devs = <&wsa881x_0211>, <&wsa881x_0212>, <&wsa881x_0213>, <&wsa881x_0214>; qcom,wsa-aux-dev-prefix = "SpkrLeft", "SpkrRight", "SpkrLeft", "SpkrRight"; }; cpe: qcom,msm-cpe-lsm { Loading
arch/arm/boot/dts/qcom/msmcobalt-wcd.dtsi 0 → 100644 +96 −0 Original line number Diff line number Diff line /* Copyright (c) 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 * only version 2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ &slim_aud { tasha_codec { wsa_spkr_sd1: msm_cdc_pinctrll { compatible = "qcom,msm-cdc-pinctrl"; pinctrl-names = "aud_active", "aud_sleep"; pinctrl-0 = <&spkr_1_sd_n_active>; pinctrl-1 = <&spkr_1_sd_n_sleep>; }; wsa_spkr_sd2: msm_cdc_pinctrlr { compatible = "qcom,msm-cdc-pinctrl"; pinctrl-names = "aud_active", "aud_sleep"; pinctrl-0 = <&spkr_2_sd_n_active>; pinctrl-1 = <&spkr_2_sd_n_sleep>; }; }; tavil_codec { wcd: wcd_pinctrl@5 { compatible = "qcom,wcd-pinctrl"; qcom,num-gpios = <5>; gpio-controller; #gpio-cells = <2>; spkr_1_wcd_en_active: spkr_1_wcd_en_active { mux { pins = "gpio2"; }; config { pins = "gpio2"; output-high; }; }; spkr_1_wcd_en_sleep: spkr_1_wcd_en_sleep { mux { pins = "gpio2"; }; config { pins = "gpio2"; input-enable; }; }; spkr_2_wcd_en_active: spkr_2_sd_n_active { mux { pins = "gpio3"; }; config { pins = "gpio3"; output-high; }; }; spkr_2_wcd_en_sleep: spkr_2_sd_n_sleep { mux { pins = "gpio3"; }; config { pins = "gpio3"; input-enable; }; }; }; wsa_spkr_wcd_sd1: msm_cdc_pinctrll { compatible = "qcom,msm-cdc-pinctrl"; pinctrl-names = "aud_active", "aud_sleep"; pinctrl-0 = <&spkr_1_wcd_en_active>; pinctrl-1 = <&spkr_1_wcd_en_sleep>; }; wsa_spkr_wcd_sd2: msm_cdc_pinctrlr { compatible = "qcom,msm-cdc-pinctrl"; pinctrl-names = "aud_active", "aud_sleep"; pinctrl-0 = <&spkr_2_wcd_en_active>; pinctrl-1 = <&spkr_2_wcd_en_sleep>; }; }; };
arch/arm/boot/dts/qcom/msmcobalt-wsa881x.dtsi +5 −22 Original line number Diff line number Diff line Loading @@ -9,24 +9,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ &soc { wsa_spkr_sd1: msm_cdc_pinctrl@65 { compatible = "qcom,msm-cdc-pinctrl"; qcom,cdc-rst-n-gpio = <&tlmm 65 0>; pinctrl-names = "aud_active", "aud_sleep"; pinctrl-0 = <&spkr_1_sd_n_active>; pinctrl-1 = <&spkr_1_sd_n_sleep>; }; wsa_spkr_sd2: msm_cdc_pinctrl@66 { compatible = "qcom,msm-cdc-pinctrl"; qcom,cdc-rst-n-gpio = <&tlmm 66 0>; pinctrl-names = "aud_active", "aud_sleep"; pinctrl-0 = <&spkr_2_sd_n_active>; pinctrl-1 = <&spkr_2_sd_n_sleep>; }; }; #include "msmcobalt-wcd.dtsi" &slim_aud { tasha_codec { Loading Loading @@ -70,25 +53,25 @@ wsa881x_0211: wsa881x@20170211 { compatible = "qcom,wsa881x"; reg = <0x00 0x20170211>; qcom,spkr-sd-n-node = <&wsa_spkr_sd1>; qcom,spkr-sd-n-node = <&wsa_spkr_wcd_sd1>; }; wsa881x_0212: wsa881x@20170212 { compatible = "qcom,wsa881x"; reg = <0x00 0x20170212>; qcom,spkr-sd-n-node = <&wsa_spkr_sd2>; qcom,spkr-sd-n-node = <&wsa_spkr_wcd_sd2>; }; wsa881x_0213: wsa881x@21170213 { compatible = "qcom,wsa881x"; reg = <0x00 0x21170213>; qcom,spkr-sd-n-node = <&wsa_spkr_sd1>; qcom,spkr-sd-n-node = <&wsa_spkr_wcd_sd1>; }; wsa881x_0214: wsa881x@21170214 { compatible = "qcom,wsa881x"; reg = <0x00 0x21170214>; qcom,spkr-sd-n-node = <&wsa_spkr_sd2>; qcom,spkr-sd-n-node = <&wsa_spkr_wcd_sd2>; }; }; }; Loading
sound/soc/codecs/wcd9335.c +49 −29 Original line number Diff line number Diff line Loading @@ -129,6 +129,7 @@ #define WCD9335_DEC_PWR_LVL_LP 0x02 #define WCD9335_DEC_PWR_LVL_HP 0x04 #define WCD9335_DEC_PWR_LVL_DF 0x00 #define WCD9335_STRING_LEN 100 #define CALCULATE_VOUT_D(req_mv) (((req_mv - 650) * 10) / 25) Loading Loading @@ -786,7 +787,7 @@ struct tasha_priv { /* to track the status */ unsigned long status_mask; struct work_struct swr_add_devices_work; struct work_struct tasha_add_child_devices_work; struct wcd_swr_ctrl_platform_data swr_plat_data; /* Port values for Rx and Tx codec_dai */ Loading Loading @@ -13464,7 +13465,7 @@ static int tasha_swrm_handle_irq(void *handle, return ret; } static void wcd_swr_ctrl_add_devices(struct work_struct *work) static void tasha_add_child_devices(struct work_struct *work) { struct tasha_priv *tasha; struct platform_device *pdev; Loading @@ -13473,9 +13474,10 @@ static void wcd_swr_ctrl_add_devices(struct work_struct *work) struct tasha_swr_ctrl_data *swr_ctrl_data = NULL, *temp; int ret, ctrl_num = 0; struct wcd_swr_ctrl_platform_data *platdata; char plat_dev_name[WCD9335_STRING_LEN]; tasha = container_of(work, struct tasha_priv, swr_add_devices_work); tasha_add_child_devices_work); if (!tasha) { pr_err("%s: Memory for WCD9335 does not exist\n", __func__); Loading @@ -13496,17 +13498,17 @@ static void wcd_swr_ctrl_add_devices(struct work_struct *work) platdata = &tasha->swr_plat_data; for_each_child_of_node(wcd9xxx->dev->of_node, node) { temp = krealloc(swr_ctrl_data, (ctrl_num + 1) * sizeof(struct tasha_swr_ctrl_data), GFP_KERNEL); if (!temp) { dev_err(wcd9xxx->dev, "out of memory\n"); ret = -ENOMEM; goto err; } swr_ctrl_data = temp; swr_ctrl_data[ctrl_num].swr_pdev = NULL; pdev = platform_device_alloc("tasha_swr_ctrl", -1); if (!strcmp(node->name, "swr_master")) strlcpy(plat_dev_name, "tasha_swr_ctrl", (WCD9335_STRING_LEN - 1)); else if (strnstr(node->name, "msm_cdc_pinctrl", strlen("msm_cdc_pinctrl")) != NULL) strlcpy(plat_dev_name, node->name, (WCD9335_STRING_LEN - 1)); else continue; pdev = platform_device_alloc(plat_dev_name, -1); if (!pdev) { dev_err(wcd9xxx->dev, "%s: pdev memory alloc failed\n", __func__); Loading @@ -13516,28 +13518,45 @@ static void wcd_swr_ctrl_add_devices(struct work_struct *work) pdev->dev.parent = tasha->dev; pdev->dev.of_node = node; if (!strcmp(node->name, "swr_master")) { ret = platform_device_add_data(pdev, platdata, sizeof(*platdata)); if (ret) { dev_err(&pdev->dev, "%s: cannot add plat data for ctrl:%d\n", dev_err(&pdev->dev, "%s: cannot add plat data ctrl:%d\n", __func__, ctrl_num); goto fail_pdev_add; } } ret = platform_device_add(pdev); if (ret) { dev_err(&pdev->dev, "%s: Cannot add swr platform device\n", dev_err(&pdev->dev, "%s: Cannot add platform device\n", __func__); goto fail_pdev_add; } if (!strcmp(node->name, "swr_master")) { temp = krealloc(swr_ctrl_data, (ctrl_num + 1) * sizeof( struct tasha_swr_ctrl_data), GFP_KERNEL); if (!temp) { dev_err(wcd9xxx->dev, "out of memory\n"); ret = -ENOMEM; goto err; } swr_ctrl_data = temp; swr_ctrl_data[ctrl_num].swr_pdev = pdev; ctrl_num++; dev_dbg(&pdev->dev, "%s: Added soundwire ctrl device(s)\n", dev_dbg(&pdev->dev, "%s: Added soundwire ctrl device(s)\n", __func__); } tasha->nr = ctrl_num; tasha->swr_ctrl_data = swr_ctrl_data; } } return; fail_pdev_add: Loading Loading @@ -13637,7 +13656,8 @@ static int tasha_probe(struct platform_device *pdev) INIT_DELAYED_WORK(&tasha->power_gate_work, tasha_codec_power_gate_work); mutex_init(&tasha->power_lock); mutex_init(&tasha->sido_lock); INIT_WORK(&tasha->swr_add_devices_work, wcd_swr_ctrl_add_devices); INIT_WORK(&tasha->tasha_add_child_devices_work, tasha_add_child_devices); BLOCKING_INIT_NOTIFIER_HEAD(&tasha->notifier); mutex_init(&tasha->micb_lock); mutex_init(&tasha->swr_read_lock); Loading Loading @@ -13713,7 +13733,7 @@ static int tasha_probe(struct platform_device *pdev) } /* Update codec register default values */ tasha_update_reg_defaults(tasha); schedule_work(&tasha->swr_add_devices_work); schedule_work(&tasha->tasha_add_child_devices_work); tasha_get_codec_ver(tasha); dev_info(&pdev->dev, "%s: Tasha driver probe done\n", __func__); Loading