max98390.c (05909cd9a0c8811731b38697af13075e8954314f) max98390.c (3cea33b6f2d7782d1be17c71509986f33ee93541)
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * max98390.c -- MAX98390 ALSA Soc Audio driver
4 *
5 * Copyright (C) 2020 Maxim Integrated Products
6 *
7 */
8

--- 770 unchanged lines hidden (view full) ---

779 }
780
781 dev_dbg(component->dev,
782 "max98390: param fw size %zd\n",
783 fw->size);
784 if (fw->size < MAX98390_DSM_PARAM_MIN_SIZE) {
785 dev_err(component->dev,
786 "param fw is invalid.\n");
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * max98390.c -- MAX98390 ALSA Soc Audio driver
4 *
5 * Copyright (C) 2020 Maxim Integrated Products
6 *
7 */
8

--- 770 unchanged lines hidden (view full) ---

779 }
780
781 dev_dbg(component->dev,
782 "max98390: param fw size %zd\n",
783 fw->size);
784 if (fw->size < MAX98390_DSM_PARAM_MIN_SIZE) {
785 dev_err(component->dev,
786 "param fw is invalid.\n");
787 ret = -EINVAL;
787 goto err_alloc;
788 }
789 dsm_param = (char *)fw->data;
790 param_start_addr = (dsm_param[0] & 0xff) | (dsm_param[1] & 0xff) << 8;
791 param_size = (dsm_param[2] & 0xff) | (dsm_param[3] & 0xff) << 8;
792 if (param_size > MAX98390_DSM_PARAM_MAX_SIZE ||
793 param_start_addr < MAX98390_IRQ_CTRL ||
794 fw->size < param_size + MAX98390_DSM_PAYLOAD_OFFSET) {
795 dev_err(component->dev,
796 "param fw is invalid.\n");
788 goto err_alloc;
789 }
790 dsm_param = (char *)fw->data;
791 param_start_addr = (dsm_param[0] & 0xff) | (dsm_param[1] & 0xff) << 8;
792 param_size = (dsm_param[2] & 0xff) | (dsm_param[3] & 0xff) << 8;
793 if (param_size > MAX98390_DSM_PARAM_MAX_SIZE ||
794 param_start_addr < MAX98390_IRQ_CTRL ||
795 fw->size < param_size + MAX98390_DSM_PAYLOAD_OFFSET) {
796 dev_err(component->dev,
797 "param fw is invalid.\n");
798 ret = -EINVAL;
797 goto err_alloc;
798 }
799 regmap_write(max98390->regmap, MAX98390_R203A_AMP_EN, 0x80);
800 dsm_param += MAX98390_DSM_PAYLOAD_OFFSET;
801 regmap_bulk_write(max98390->regmap, param_start_addr,
802 dsm_param, param_size);
803 regmap_write(max98390->regmap, MAX98390_R23E1_DSP_GLOBAL_EN, 0x01);
804

--- 250 unchanged lines hidden ---
799 goto err_alloc;
800 }
801 regmap_write(max98390->regmap, MAX98390_R203A_AMP_EN, 0x80);
802 dsm_param += MAX98390_DSM_PAYLOAD_OFFSET;
803 regmap_bulk_write(max98390->regmap, param_start_addr,
804 dsm_param, param_size);
805 regmap_write(max98390->regmap, MAX98390_R23E1_DSP_GLOBAL_EN, 0x01);
806

--- 250 unchanged lines hidden ---