tas571x.c (630e413dc24da0c2373fd7592aeb0e08cea71cd1) | tas571x.c (a593ed09040fa611f37953afe455e64c7653160d) |
---|---|
1/* 2 * TAS571x amplifier audio driver 3 * 4 * Copyright (C) 2015 Google, Inc. 5 * Copyright (c) 2013 Daniel Mack <zonque@gmail.com> 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by --- 43 unchanged lines hidden (view full) --- 52 53static int tas571x_register_size(struct tas571x_private *priv, unsigned int reg) 54{ 55 switch (reg) { 56 case TAS571X_MVOL_REG: 57 case TAS571X_CH1_VOL_REG: 58 case TAS571X_CH2_VOL_REG: 59 return priv->chip->vol_reg_size; | 1/* 2 * TAS571x amplifier audio driver 3 * 4 * Copyright (C) 2015 Google, Inc. 5 * Copyright (c) 2013 Daniel Mack <zonque@gmail.com> 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by --- 43 unchanged lines hidden (view full) --- 52 53static int tas571x_register_size(struct tas571x_private *priv, unsigned int reg) 54{ 55 switch (reg) { 56 case TAS571X_MVOL_REG: 57 case TAS571X_CH1_VOL_REG: 58 case TAS571X_CH2_VOL_REG: 59 return priv->chip->vol_reg_size; |
60 case TAS571X_INPUT_MUX_REG: 61 case TAS571X_CH4_SRC_SELECT_REG: 62 case TAS571X_PWM_MUX_REG: 63 return 4; |
|
60 default: 61 return 1; 62 } 63} 64 65static int tas571x_reg_write(void *context, unsigned int reg, 66 unsigned int value) 67{ --- 186 unchanged lines hidden (view full) --- 254 TAS571X_CH2_VOL_REG, 255 0, 0xff, 1, tas5711_volume_tlv), 256 SOC_DOUBLE("Speaker Switch", 257 TAS571X_SOFT_MUTE_REG, 258 TAS571X_SOFT_MUTE_CH1_SHIFT, TAS571X_SOFT_MUTE_CH2_SHIFT, 259 1, 1), 260}; 261 | 64 default: 65 return 1; 66 } 67} 68 69static int tas571x_reg_write(void *context, unsigned int reg, 70 unsigned int value) 71{ --- 186 unchanged lines hidden (view full) --- 258 TAS571X_CH2_VOL_REG, 259 0, 0xff, 1, tas5711_volume_tlv), 260 SOC_DOUBLE("Speaker Switch", 261 TAS571X_SOFT_MUTE_REG, 262 TAS571X_SOFT_MUTE_CH1_SHIFT, TAS571X_SOFT_MUTE_CH2_SHIFT, 263 1, 1), 264}; 265 |
266static const struct regmap_range tas571x_readonly_regs_range[] = { 267 regmap_reg_range(TAS571X_CLK_CTRL_REG, TAS571X_DEV_ID_REG), 268}; 269 270static const struct regmap_range tas571x_volatile_regs_range[] = { 271 regmap_reg_range(TAS571X_CLK_CTRL_REG, TAS571X_ERR_STATUS_REG), 272 regmap_reg_range(TAS571X_OSC_TRIM_REG, TAS571X_OSC_TRIM_REG), 273}; 274 275static const struct regmap_access_table tas571x_write_regs = { 276 .no_ranges = tas571x_readonly_regs_range, 277 .n_no_ranges = ARRAY_SIZE(tas571x_readonly_regs_range), 278}; 279 280static const struct regmap_access_table tas571x_volatile_regs = { 281 .yes_ranges = tas571x_volatile_regs_range, 282 .n_yes_ranges = ARRAY_SIZE(tas571x_volatile_regs_range), 283 284}; 285 |
|
262static const struct reg_default tas5711_reg_defaults[] = { 263 { 0x04, 0x05 }, 264 { 0x05, 0x40 }, 265 { 0x06, 0x00 }, 266 { 0x07, 0xff }, 267 { 0x08, 0x30 }, 268 { 0x09, 0x30 }, 269 { 0x1b, 0x82 }, 270}; 271 272static const struct regmap_config tas5711_regmap_config = { 273 .reg_bits = 8, 274 .val_bits = 32, 275 .max_register = 0xff, 276 .reg_read = tas571x_reg_read, 277 .reg_write = tas571x_reg_write, 278 .reg_defaults = tas5711_reg_defaults, 279 .num_reg_defaults = ARRAY_SIZE(tas5711_reg_defaults), 280 .cache_type = REGCACHE_RBTREE, | 286static const struct reg_default tas5711_reg_defaults[] = { 287 { 0x04, 0x05 }, 288 { 0x05, 0x40 }, 289 { 0x06, 0x00 }, 290 { 0x07, 0xff }, 291 { 0x08, 0x30 }, 292 { 0x09, 0x30 }, 293 { 0x1b, 0x82 }, 294}; 295 296static const struct regmap_config tas5711_regmap_config = { 297 .reg_bits = 8, 298 .val_bits = 32, 299 .max_register = 0xff, 300 .reg_read = tas571x_reg_read, 301 .reg_write = tas571x_reg_write, 302 .reg_defaults = tas5711_reg_defaults, 303 .num_reg_defaults = ARRAY_SIZE(tas5711_reg_defaults), 304 .cache_type = REGCACHE_RBTREE, |
305 .wr_table = &tas571x_write_regs, 306 .volatile_table = &tas571x_volatile_regs, |
|
281}; 282 283static const struct tas571x_chip tas5711_chip = { 284 .supply_names = tas5711_supply_names, 285 .num_supply_names = ARRAY_SIZE(tas5711_supply_names), 286 .controls = tas5711_controls, 287 .num_controls = ARRAY_SIZE(tas5711_controls), 288 .regmap_config = &tas5711_regmap_config, --- 38 unchanged lines hidden (view full) --- 327 .reg_bits = 8, 328 .val_bits = 32, 329 .max_register = 0xff, 330 .reg_read = tas571x_reg_read, 331 .reg_write = tas571x_reg_write, 332 .reg_defaults = tas5717_reg_defaults, 333 .num_reg_defaults = ARRAY_SIZE(tas5717_reg_defaults), 334 .cache_type = REGCACHE_RBTREE, | 307}; 308 309static const struct tas571x_chip tas5711_chip = { 310 .supply_names = tas5711_supply_names, 311 .num_supply_names = ARRAY_SIZE(tas5711_supply_names), 312 .controls = tas5711_controls, 313 .num_controls = ARRAY_SIZE(tas5711_controls), 314 .regmap_config = &tas5711_regmap_config, --- 38 unchanged lines hidden (view full) --- 353 .reg_bits = 8, 354 .val_bits = 32, 355 .max_register = 0xff, 356 .reg_read = tas571x_reg_read, 357 .reg_write = tas571x_reg_write, 358 .reg_defaults = tas5717_reg_defaults, 359 .num_reg_defaults = ARRAY_SIZE(tas5717_reg_defaults), 360 .cache_type = REGCACHE_RBTREE, |
361 .wr_table = &tas571x_write_regs, 362 .volatile_table = &tas571x_volatile_regs, |
|
335}; 336 337/* This entry is reused for tas5719 as the software interface is identical. */ 338static const struct tas571x_chip tas5717_chip = { 339 .supply_names = tas5717_supply_names, 340 .num_supply_names = ARRAY_SIZE(tas5717_supply_names), 341 .controls = tas5717_controls, 342 .num_controls = ARRAY_SIZE(tas5717_controls), --- 185 unchanged lines hidden --- | 363}; 364 365/* This entry is reused for tas5719 as the software interface is identical. */ 366static const struct tas571x_chip tas5717_chip = { 367 .supply_names = tas5717_supply_names, 368 .num_supply_names = ARRAY_SIZE(tas5717_supply_names), 369 .controls = tas5717_controls, 370 .num_controls = ARRAY_SIZE(tas5717_controls), --- 185 unchanged lines hidden --- |